dimforge / dimforge/bevy_rapier
Bug with Dynamic rigidbody creation
- Dominant language
- Rust
- Stars
- 1.6k
- Forks
- 282
- PR merge metrics
- No merged PRs in 30d
Description
I noticed that if I first add a Collider component to an object, and then I add a RigidBody::Dynamic component to the same object in another render frame, then the added Collider is not used when calculating the Rigidbody. (Or created rigidbody is static)
```rust
\\create child of ship before playing
let id = cmds.spawn(SceneBundle {
scene: asset_server.load(&owned_path),
..default()
})
.insert(instance.clone())
.insert(InstanceRotate::default()).id();
let collider_pos = -instance.origin.clone() * bbox.as_vec3() / 2.0 * VOXEL_SIZE;
let collider = ColliderBuilder::cuboid(
bbox.x as f32 * VOXEL_SIZE / 2.0,
bbox.y as f32 * VOXEL_SIZE / 2.0,
bbox.z as f32 * VOXEL_SIZE / 2.0
).translation(collider_pos.into()).build();
cmds.entity(id)
.insert(Collider::from(collider.shared_shape().clone()));
```
```rust
//add rigidbody to ship when player click Play button
let (ship_e, ship, ship_children) = ships.get_mut(block.ship).unwrap();
cmds.entity(ship_e).insert(RigidBody::Dynamic);
for child in ship_children.iter() {
cmds.entity(*child).insert(RigidBody::Dynamic);
}
```
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.