diff options
| author | Sébastien Crozet <developer@crozet.re> | 2022-08-25 11:09:00 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-08-25 11:09:00 +0200 |
| commit | a1802323285622e0626cd69c7ea3b3ca60638b2e (patch) | |
| tree | 75627217e36547a149312fe4d859a925c064b2a7 /src | |
| parent | 2b5c52a89f65b5d5fec4862d9f047bbdbb3defa8 (diff) | |
| parent | d73508602eb15088c05b4738d1d87c60e37b3b21 (diff) | |
| download | rapier-a1802323285622e0626cd69c7ea3b3ca60638b2e.tar.gz rapier-a1802323285622e0626cd69c7ea3b3ca60638b2e.tar.bz2 rapier-a1802323285622e0626cd69c7ea3b3ca60638b2e.zip | |
Merge pull request #390 from dimforge/auto-mass-props
Auto-update a rigid-body’s world mass-properties when the user sets their position
Diffstat (limited to 'src')
| -rw-r--r-- | src/dynamics/rigid_body.rs | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/dynamics/rigid_body.rs b/src/dynamics/rigid_body.rs index ee64f93..9c38eee 100644 --- a/src/dynamics/rigid_body.rs +++ b/src/dynamics/rigid_body.rs @@ -666,6 +666,9 @@ impl RigidBody { self.pos.position.translation.vector = translation; self.pos.next_position.translation.vector = translation; + // Update the world mass-properties so torque application remains valid. + self.update_world_mass_properties(); + // TODO: Do we really need to check that the body isn't dynamic? if wake_up && self.is_dynamic() { self.wake_up(true) @@ -687,6 +690,9 @@ impl RigidBody { self.pos.position.rotation = rotation; self.pos.next_position.rotation = rotation; + // Update the world mass-properties so torque application remains valid. + self.update_world_mass_properties(); + // TODO: Do we really need to check that the body isn't dynamic? if wake_up && self.is_dynamic() { self.wake_up(true) @@ -709,6 +715,9 @@ impl RigidBody { self.pos.position = pos; self.pos.next_position = pos; + // Update the world mass-properties so torque application remains valid. + self.update_world_mass_properties(); + // TODO: Do we really need to check that the body isn't dynamic? if wake_up && self.is_dynamic() { self.wake_up(true) |
