Fix errors related to joints setup with two non-dynamic bodies
This commit is contained in:
parent
b8bd648ad9
commit
60ae264db1
6 changed files with 33 additions and 0 deletions
|
@ -97,8 +97,13 @@ normal_relative_velocity(Body2DSW *a, Body2DSW *b, Vector2 rA, Vector2 rB, Vecto
|
|||
}
|
||||
|
||||
bool PinJoint2DSW::setup(real_t p_step) {
|
||||
if ((A->get_mode() <= PhysicsServer2D::BODY_MODE_KINEMATIC) && (B->get_mode() <= PhysicsServer2D::BODY_MODE_KINEMATIC)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
Space2DSW *space = A->get_space();
|
||||
ERR_FAIL_COND_V(!space, false);
|
||||
|
||||
rA = A->get_transform().basis_xform(anchor_A);
|
||||
rB = B ? B->get_transform().basis_xform(anchor_B) : anchor_B;
|
||||
|
||||
|
@ -257,6 +262,10 @@ mult_k(const Vector2 &vr, const Vector2 &k1, const Vector2 &k2) {
|
|||
}
|
||||
|
||||
bool GrooveJoint2DSW::setup(real_t p_step) {
|
||||
if ((A->get_mode() <= PhysicsServer2D::BODY_MODE_KINEMATIC) && (B->get_mode() <= PhysicsServer2D::BODY_MODE_KINEMATIC)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// calculate endpoints in worldspace
|
||||
Vector2 ta = A->get_transform().xform(A_groove_1);
|
||||
Vector2 tb = A->get_transform().xform(A_groove_2);
|
||||
|
@ -342,6 +351,10 @@ GrooveJoint2DSW::GrooveJoint2DSW(const Vector2 &p_a_groove1, const Vector2 &p_a_
|
|||
//////////////////////////////////////////////
|
||||
|
||||
bool DampedSpringJoint2DSW::setup(real_t p_step) {
|
||||
if ((A->get_mode() <= PhysicsServer2D::BODY_MODE_KINEMATIC) && (B->get_mode() <= PhysicsServer2D::BODY_MODE_KINEMATIC)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
rA = A->get_transform().basis_xform(anchor_A);
|
||||
rB = B->get_transform().basis_xform(anchor_B);
|
||||
|
||||
|
|
|
@ -109,6 +109,10 @@ ConeTwistJoint3DSW::ConeTwistJoint3DSW(Body3DSW *rbA, Body3DSW *rbB, const Trans
|
|||
}
|
||||
|
||||
bool ConeTwistJoint3DSW::setup(real_t p_timestep) {
|
||||
if ((A->get_mode() <= PhysicsServer3D::BODY_MODE_KINEMATIC) && (B->get_mode() <= PhysicsServer3D::BODY_MODE_KINEMATIC)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
m_appliedImpulse = real_t(0.);
|
||||
|
||||
//set bias, sign, clear accumulator
|
||||
|
|
|
@ -303,6 +303,10 @@ bool Generic6DOFJoint3DSW::testAngularLimitMotor(int axis_index) {
|
|||
}
|
||||
|
||||
bool Generic6DOFJoint3DSW::setup(real_t p_timestep) {
|
||||
if ((A->get_mode() <= PhysicsServer3D::BODY_MODE_KINEMATIC) && (B->get_mode() <= PhysicsServer3D::BODY_MODE_KINEMATIC)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Clear accumulated impulses for the next simulation step
|
||||
m_linearLimits.m_accumulatedImpulse = Vector3(real_t(0.), real_t(0.), real_t(0.));
|
||||
int i;
|
||||
|
|
|
@ -155,6 +155,10 @@ HingeJoint3DSW::HingeJoint3DSW(Body3DSW *rbA, Body3DSW *rbB, const Vector3 &pivo
|
|||
}
|
||||
|
||||
bool HingeJoint3DSW::setup(real_t p_step) {
|
||||
if ((A->get_mode() <= PhysicsServer3D::BODY_MODE_KINEMATIC) && (B->get_mode() <= PhysicsServer3D::BODY_MODE_KINEMATIC)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
m_appliedImpulse = real_t(0.);
|
||||
|
||||
if (!m_angularOnly) {
|
||||
|
|
|
@ -50,6 +50,10 @@ subject to the following restrictions:
|
|||
#include "pin_joint_3d_sw.h"
|
||||
|
||||
bool PinJoint3DSW::setup(real_t p_step) {
|
||||
if ((A->get_mode() <= PhysicsServer3D::BODY_MODE_KINEMATIC) && (B->get_mode() <= PhysicsServer3D::BODY_MODE_KINEMATIC)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
m_appliedImpulse = real_t(0.);
|
||||
|
||||
Vector3 normal(0, 0, 0);
|
||||
|
|
|
@ -127,6 +127,10 @@ SliderJoint3DSW::SliderJoint3DSW(Body3DSW *rbA, Body3DSW *rbB, const Transform &
|
|||
//-----------------------------------------------------------------------------
|
||||
|
||||
bool SliderJoint3DSW::setup(real_t p_step) {
|
||||
if ((A->get_mode() <= PhysicsServer3D::BODY_MODE_KINEMATIC) && (B->get_mode() <= PhysicsServer3D::BODY_MODE_KINEMATIC)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
//calculate transforms
|
||||
m_calculatedTransformA = A->get_transform() * m_frameInA;
|
||||
m_calculatedTransformB = B->get_transform() * m_frameInB;
|
||||
|
|
Loading…
Reference in a new issue