Merge pull request #41528 from keegano/physics-fix-wrap-angle

Wrap angles to (-pi, pi) in momentum calculation.
This commit is contained in:
Rémi Verschelde 2020-09-17 16:32:53 +02:00 committed by GitHub
commit 2d9b409103
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -468,7 +468,7 @@ void Body2DSW::integrate_forces(real_t p_step) {
linear_velocity = motion / p_step;
real_t rot = new_transform.get_rotation() - get_transform().get_rotation();
angular_velocity = rot / p_step;
angular_velocity = remainder(rot, 2.0 * Math_PI) / p_step;
do_motion = true;