Skip to content

Commit

Permalink
Fix static body constant velocity to not cumulate (#183)
Browse files Browse the repository at this point in the history
  • Loading branch information
Ughuuu committed Aug 5, 2024
1 parent af84509 commit 9f699f5
Showing 1 changed file with 2 additions and 8 deletions.
10 changes: 2 additions & 8 deletions src/bodies/rapier_body.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1174,17 +1174,11 @@ impl RapierBody {
space.body_add_to_state_query_list(self.base.get_rid());
if self.base.mode.ord() >= BodyMode::RIGID.ord() {
if self.to_add_angular_velocity != ANGLE_ZERO {
self.set_angular_velocity(
self.get_angular_velocity(physics_engine) + self.to_add_angular_velocity,
physics_engine,
);
self.set_angular_velocity(self.to_add_angular_velocity, physics_engine);
self.to_add_angular_velocity = ANGLE_ZERO;
}
if self.to_add_linear_velocity != Vector::default() {
self.set_linear_velocity(
self.get_linear_velocity(physics_engine) + self.to_add_linear_velocity,
physics_engine,
);
self.set_linear_velocity(self.to_add_linear_velocity, physics_engine);
self.to_add_linear_velocity = Vector::default();
}
}
Expand Down

0 comments on commit 9f699f5

Please sign in to comment.