Merge pull request #51749 from LoipesMas/3.x

[3.x] Epsilon check for angular velocity in BodySW
This commit is contained in:
Rémi Verschelde 2021-08-16 20:41:43 +02:00 committed by GitHub
commit 7a657b9b1c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -614,7 +614,7 @@ void BodySW::integrate_velocities(real_t p_step) {
real_t ang_vel = total_angular_velocity.length(); real_t ang_vel = total_angular_velocity.length();
Transform transform = get_transform(); Transform transform = get_transform();
if (ang_vel != 0.0) { if (!Math::is_zero_approx(ang_vel)) {
Vector3 ang_vel_axis = total_angular_velocity / ang_vel; Vector3 ang_vel_axis = total_angular_velocity / ang_vel;
Basis rot(ang_vel_axis, ang_vel * p_step); Basis rot(ang_vel_axis, ang_vel * p_step);
Basis identity3(1, 0, 0, 0, 1, 0, 0, 0, 1); Basis identity3(1, 0, 0, 0, 1, 0, 0, 0, 1);