diff options
author | RĂ©mi Verschelde <rverschelde@gmail.com> | 2020-09-17 16:32:53 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-09-17 16:32:53 +0200 |
commit | 2d9b409103f8bb0ee565b40cc3d4709939862e56 (patch) | |
tree | ea9a3605d5140c7c9567148760f8dbab5aa72283 | |
parent | 377c3bb25672fb7060cbd465a698661a93290e07 (diff) | |
parent | e148338d428de9d23517c5410853a94dc72458ff (diff) |
Merge pull request #41528 from keegano/physics-fix-wrap-angle
Wrap angles to (-pi, pi) in momentum calculation.
-rw-r--r-- | servers/physics_2d/body_2d_sw.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/servers/physics_2d/body_2d_sw.cpp b/servers/physics_2d/body_2d_sw.cpp index 856bba78f7..75c9a95739 100644 --- a/servers/physics_2d/body_2d_sw.cpp +++ b/servers/physics_2d/body_2d_sw.cpp @@ -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; |