diff options
author | RĂ©mi Verschelde <remi@verschelde.fr> | 2021-04-13 10:10:53 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-04-13 10:10:53 +0200 |
commit | 3838036a88c6ed6d9b8ec1be49b4f0b5243f6f26 (patch) | |
tree | 23af8f88d6bc5e131d44f3776781b7dbfd341aca /servers/physics_3d | |
parent | a9c29fdc1f785c3f2f122f1336cb98e0ece54d50 (diff) | |
parent | 70aa39d127483a1e9d57db24bca0e2aaa9debc33 (diff) |
Merge pull request #47845 from nekomatata/fix-soft-body-contact-impulses
Diffstat (limited to 'servers/physics_3d')
-rw-r--r-- | servers/physics_3d/body_pair_3d_sw.cpp | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/servers/physics_3d/body_pair_3d_sw.cpp b/servers/physics_3d/body_pair_3d_sw.cpp index 36114c0c91..ef4dca7dcf 100644 --- a/servers/physics_3d/body_pair_3d_sw.cpp +++ b/servers/physics_3d/body_pair_3d_sw.cpp @@ -645,7 +645,7 @@ bool BodySoftBodyPair3DSW::setup(real_t p_step) { c.depth = depth; Vector3 j_vec = c.normal * c.acc_normal_impulse + c.acc_tangent_impulse; - body->apply_impulse(c.rA + body->get_center_of_mass(), -j_vec); + body->apply_impulse(-j_vec, c.rA + body->get_center_of_mass()); soft_body->apply_node_impulse(c.index_B, j_vec); c.acc_bias_impulse = 0; c.acc_bias_impulse_center_of_mass = 0; @@ -691,7 +691,7 @@ void BodySoftBodyPair3DSW::solve(real_t p_step) { Vector3 jb = c.normal * (c.acc_bias_impulse - jbnOld); - body->apply_bias_impulse(c.rA + body->get_center_of_mass(), -jb, MAX_BIAS_ROTATION / p_step); + body->apply_bias_impulse(-jb, c.rA + body->get_center_of_mass(), MAX_BIAS_ROTATION / p_step); soft_body->apply_node_bias_impulse(c.index_B, jb); crbA = body->get_biased_angular_velocity().cross(c.rA); @@ -706,8 +706,8 @@ void BodySoftBodyPair3DSW::solve(real_t p_step) { Vector3 jb_com = c.normal * (c.acc_bias_impulse_center_of_mass - jbnOld_com); - body->apply_bias_impulse(body->get_center_of_mass(), -jb_com, 0.0f); - soft_body->apply_node_bias_impulse(c.index_B, -jb_com); + body->apply_bias_impulse(-jb_com, body->get_center_of_mass(), 0.0f); + soft_body->apply_node_bias_impulse(c.index_B, jb_com); } c.active = true; @@ -726,7 +726,7 @@ void BodySoftBodyPair3DSW::solve(real_t p_step) { Vector3 j = c.normal * (c.acc_normal_impulse - jnOld); - body->apply_impulse(c.rA + body->get_center_of_mass(), -j); + body->apply_impulse(-j, c.rA + body->get_center_of_mass()); soft_body->apply_node_impulse(c.index_B, j); c.active = true; @@ -767,7 +767,7 @@ void BodySoftBodyPair3DSW::solve(real_t p_step) { jt = c.acc_tangent_impulse - jtOld; - body->apply_impulse(c.rA + body->get_center_of_mass(), -jt); + body->apply_impulse(-jt, c.rA + body->get_center_of_mass()); soft_body->apply_node_impulse(c.index_B, jt); c.active = true; |