diff options
author | Aaron Franke <arnfranke@yahoo.com> | 2020-03-26 00:23:34 -0400 |
---|---|---|
committer | Aaron Franke <arnfranke@yahoo.com> | 2020-06-02 23:18:59 -0400 |
commit | ba27deef06f0152a59c86e3b0ab3ebb0976344ad (patch) | |
tree | 9c5e8fac16de8beb6a657c7a2f5386f3190292f5 /servers/physics_3d/joints/slider_joint_3d_sw.cpp | |
parent | 030a26206ff70b1050c885270afce89b0430af70 (diff) |
Refactor physics force and impulse code
Diffstat (limited to 'servers/physics_3d/joints/slider_joint_3d_sw.cpp')
-rw-r--r-- | servers/physics_3d/joints/slider_joint_3d_sw.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/servers/physics_3d/joints/slider_joint_3d_sw.cpp b/servers/physics_3d/joints/slider_joint_3d_sw.cpp index 5b4609f24e..43bd49b4b5 100644 --- a/servers/physics_3d/joints/slider_joint_3d_sw.cpp +++ b/servers/physics_3d/joints/slider_joint_3d_sw.cpp @@ -197,8 +197,8 @@ void SliderJoint3DSW::solve(real_t p_step) { // calcutate and apply impulse real_t normalImpulse = softness * (restitution * depth / p_step - damping * rel_vel) * m_jacLinDiagABInv[i]; Vector3 impulse_vector = normal * normalImpulse; - A->apply_impulse(m_relPosA, impulse_vector); - B->apply_impulse(m_relPosB, -impulse_vector); + A->apply_impulse(impulse_vector, m_relPosA); + B->apply_impulse(-impulse_vector, m_relPosB); if (m_poweredLinMotor && (!i)) { // apply linear motor if (m_accumulatedLinMotorImpulse < m_maxLinMotorForce) { real_t desiredMotorVel = m_targetLinMotorVelocity; @@ -218,8 +218,8 @@ void SliderJoint3DSW::solve(real_t p_step) { m_accumulatedLinMotorImpulse = new_acc; // apply clamped impulse impulse_vector = normal * normalImpulse; - A->apply_impulse(m_relPosA, impulse_vector); - B->apply_impulse(m_relPosB, -impulse_vector); + A->apply_impulse(impulse_vector, m_relPosA); + B->apply_impulse(-impulse_vector, m_relPosB); } } } |