mirror of
https://github.com/godotengine/godot.git
synced 2024-11-11 06:33:10 +00:00
Wrap angles to (-pi, pi) in momentum calculation.
Fixes a bug that causes KinematicBody2Ds to produce too much angular momentum when rotating beyond 180 degrees.
This commit is contained in:
parent
443686d724
commit
e148338d42
@ -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;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user