diff options
author | PouleyKetchoupp <pouleyketchoup@gmail.com> | 2021-04-12 17:31:46 -0700 |
---|---|---|
committer | PouleyKetchoupp <pouleyketchoup@gmail.com> | 2021-04-12 17:38:14 -0700 |
commit | 70aa39d127483a1e9d57db24bca0e2aaa9debc33 (patch) | |
tree | 0409d10723cb4c786652412f022b44c6ea1b09bc | |
parent | 075f358fcddbb3df8417ef85baabdf3684a4efd2 (diff) |
Fix SoftBody contact impulses applied on rigid bodies
Parameters were inverted in `apply_impulse` and `apply_bias_impulse` due
to a modification on master.
-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; |