-
how do I convert this Cube to a Cuboid? commands.spawn(PbrBundle {
mesh: meshes.add(Mesh::from(shape::Cube { size: 1.0 })
),
material: materials.add(StandardMaterial{
base_color: Color::rgb(0.5, 0.5, 1.0),
unlit: true,
..default()
}),
transform: Transform::from_translation(Vec3::new(1.5, 0.0, 0.0)),
..Default::default()
}); warning: use of deprecated struct `bevy::prelude::shape::Cube`: please use the `Cuboid` primitive for meshing or `Aabb2d` for a bounding volume
--> src/setup.rs:73:44
|
73 | mesh: meshes.add(Mesh::from(shape::Cube { size: 1.0 })
| ^^^^
|
= note: `#[warn(deprecated)]` on by default
|
Beta Was this translation helpful? Give feedback.
Answered by
nezuo
Apr 12, 2024
Replies: 2 comments 5 replies
-
this did the trick but letme know if there is a better way of doing this commands.spawn(PbrBundle {
mesh: meshes.add(Mesh::from(Cuboid {
half_size: Vec3::new(1.0 / 2.0, 1.0 / 2.0, 1.0 / 2.0)
})),
material: materials.add(StandardMaterial{
base_color: Color::rgb(0.5, 0.5, 1.0),
unlit: true,
..default()
}),
transform: Transform::from_translation(Vec3::new(1.5, 0.0, 0.0)),
..Default::default()
}); |
Beta Was this translation helpful? Give feedback.
2 replies
-
ty to both of you. I ended up doing commands.spawn(PbrBundle {
mesh: meshes.add(Cuboid::from_size(Vec3::splat(0.5))),
material: materials.add(StandardMaterial{
base_color: Color::rgb(0.5, 0.5, 1.0),
unlit: true,
..default()
}),
transform: Transform::from_xyz(1.5, 0.0, 0.0),
..Default::default()
}); as suggested, unlit included though |
Beta Was this translation helpful? Give feedback.
3 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Yes, that would result in a cube that's 1 unit in length.