Collider is spawned in center before go to correct position #6772
-
Hi, I'm getting a problem when spawn Collider at the right end of window. Video demo for problem: When spawn, the code just insert Collider and TransformBundle, so I'm not sure where this problem comes from. Bevy version: 0.9 fn new_pole(mut command: Commands, windows: Res<Windows>) { let window = windows.get_primary().unwrap();
...
command
.spawn(Collider::cuboid(pole_width, upper_height / 2.))
.insert(TransformBundle::from(Transform::from_xyz(
window.width() / 2.,
window.height() / 2. - upper_height / 2.,
0.,
)))
.insert(Pole);
}
...
fn main() {
App::new()
.add_plugin(RapierDebugRenderPlugin::default())
...
.add_system_set(
SystemSet::new()
.with_run_criteria(FixedTimestep::step(3.))
.with_system(new_pole),
)
.run();
} |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 4 replies
-
Instead of .insert, you should put it in a tuple together with the Collider: |
Beta Was this translation helpful? Give feedback.
-
Adding the right |
Beta Was this translation helpful? Give feedback.
Adding the right
RigidBody
component variant may help.