Static bodies' positions aren't propagated to collision world
- Dominant language
- Rust
- Stars
- 1.6k
- Forks
- 120
- PR merge metrics
- No merged PRs in 30d
Description
Changing the position of a static body using `set_transformation` and related methods has no apparent effect, as its position in the collision world remains unchanged. A simple workaround is to add this method to the `World` class:
/// Acknowledge changes to a static rigid body's position.
pub fn update_static_body_position(&mut self, b: &RigidBodyHandle) {
let rb = b.borrow_mut();
self.cworld.deferred_set_position(&**b as *const RefCell> as usize,
rb.position().clone());
}
However, this may be considered a bit of a hack. On the other hand, I'm not sure what a better solution would be. Adding a branch to `set_transformation` to check if the body is static (and if so, add it to a list of objects that need to be updated) might be slow for many physics objects. If sensors and rigid bodies are now distinct objects, though, maybe it would be worth it to have type-level distinction between dynamic and static bodies. For now, the hack does just fine.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.