Hello, I have written the below code:
#[derive(Component)]
pub struct Robot {
name: String,
// The root component/head of the robot
root_body: (
PbrBundle,
RigidBody,
AsyncCollider,
),
}
pub fn spawn_robot_from_urdf(
mut commands: Commands,
mut meshes: ResMut<Assets<Mesh>>,
mut materials: ResMut<Assets<StandardMaterial>>,
assset_server: Res<AssetServer>,
model_query: Query<Entity, With<Robot>>,
) {
let diff_bot = commands.spawn(
(
Robot {
name: "diff_bot".to_owned(),
root_body: (
PbrBundle {
mesh: meshes.add(Mesh::from(shape::Cube { size: 10.0 })),
material: materials.add(Color::rgb(0.8, 0.7, 0.6).into()),
transform: Transform::from_xyz(0.0, 0.0, 0.0),
..default()
},
//physics properties
RigidBody::Dynamic, // set this object to be a dynamic rigid body
AsyncCollider(ComputedColliderShape::ConvexDecomposition
(
default()
),
)),
},
)
).id();
Without the struct(as below) the cube spawns though?
let diff_bot = commands.spawn(
(
PbrBundle {
mesh: meshes.add(Mesh::from(shape::Cube { size: 100.0 })),
material: materials.add(Color::rgb(0.8, 0.7, 0.6).into()),
transform: Transform::from_xyz(0.0, 0.0, 0.0),
..default()
},
//physics properties
RigidBody::Dynamic, // set this object to be a dynamic rigid body
AsyncCollider(ComputedColliderShape::ConvexDecomposition
(
default()
),
))).id();
What is wrong with the first code block?