Fix errors related to joints setup with two non-dynamic bodies
This commit is contained in:
parent
595a74ca79
commit
64b11b6126
6 changed files with 26 additions and 0 deletions
|
@ -111,6 +111,10 @@ ConeTwistJointSW::ConeTwistJointSW(BodySW *rbA, BodySW *rbB, const Transform &rb
|
|||
}
|
||||
|
||||
bool ConeTwistJointSW::setup(real_t p_timestep) {
|
||||
if ((A->get_mode() <= PhysicsServer::BODY_MODE_KINEMATIC) && (B->get_mode() <= PhysicsServer::BODY_MODE_KINEMATIC)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
m_appliedImpulse = real_t(0.);
|
||||
|
||||
//set bias, sign, clear accumulator
|
||||
|
|
|
@ -301,6 +301,9 @@ bool Generic6DOFJointSW::testAngularLimitMotor(int axis_index) {
|
|||
}
|
||||
|
||||
bool Generic6DOFJointSW::setup(real_t p_timestep) {
|
||||
if ((A->get_mode() <= PhysicsServer::BODY_MODE_KINEMATIC) && (B->get_mode() <= PhysicsServer::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.));
|
||||
|
|
|
@ -158,6 +158,9 @@ HingeJointSW::HingeJointSW(BodySW *rbA, BodySW *rbB, const Vector3 &pivotInA, co
|
|||
}
|
||||
|
||||
bool HingeJointSW::setup(real_t p_step) {
|
||||
if ((A->get_mode() <= PhysicsServer::BODY_MODE_KINEMATIC) && (B->get_mode() <= PhysicsServer::BODY_MODE_KINEMATIC)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
m_appliedImpulse = real_t(0.);
|
||||
|
||||
|
|
|
@ -50,6 +50,9 @@ subject to the following restrictions:
|
|||
#include "pin_joint_sw.h"
|
||||
|
||||
bool PinJointSW::setup(real_t p_step) {
|
||||
if ((A->get_mode() <= PhysicsServer::BODY_MODE_KINEMATIC) && (B->get_mode() <= PhysicsServer::BODY_MODE_KINEMATIC)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
m_appliedImpulse = real_t(0.);
|
||||
|
||||
|
|
|
@ -129,6 +129,9 @@ SliderJointSW::SliderJointSW(BodySW *rbA, BodySW *rbB, const Transform &frameInA
|
|||
//-----------------------------------------------------------------------------
|
||||
|
||||
bool SliderJointSW::setup(real_t p_step) {
|
||||
if ((A->get_mode() <= PhysicsServer::BODY_MODE_KINEMATIC) && (B->get_mode() <= PhysicsServer::BODY_MODE_KINEMATIC)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
//calculate transforms
|
||||
m_calculatedTransformA = A->get_transform() * m_frameInA;
|
||||
|
|
|
@ -90,9 +90,13 @@ normal_relative_velocity(Body2DSW *a, Body2DSW *b, Vector2 rA, Vector2 rB, Vecto
|
|||
}
|
||||
|
||||
bool PinJoint2DSW::setup(real_t p_step) {
|
||||
if ((A->get_mode() <= Physics2DServer::BODY_MODE_KINEMATIC) && (B->get_mode() <= Physics2DServer::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;
|
||||
|
||||
|
@ -259,6 +263,9 @@ mult_k(const Vector2 &vr, const Vector2 &k1, const Vector2 &k2) {
|
|||
}
|
||||
|
||||
bool GrooveJoint2DSW::setup(real_t p_step) {
|
||||
if ((A->get_mode() <= Physics2DServer::BODY_MODE_KINEMATIC) && (B->get_mode() <= Physics2DServer::BODY_MODE_KINEMATIC)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// calculate endpoints in worldspace
|
||||
Vector2 ta = A->get_transform().xform(A_groove_1);
|
||||
|
@ -353,6 +360,9 @@ GrooveJoint2DSW::~GrooveJoint2DSW() {
|
|||
//////////////////////////////////////////////
|
||||
|
||||
bool DampedSpringJoint2DSW::setup(real_t p_step) {
|
||||
if ((A->get_mode() <= Physics2DServer::BODY_MODE_KINEMATIC) && (B->get_mode() <= Physics2DServer::BODY_MODE_KINEMATIC)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
rA = A->get_transform().basis_xform(anchor_A);
|
||||
rB = B->get_transform().basis_xform(anchor_B);
|
||||
|
|
Loading…
Reference in a new issue