Fix errors related to joints setup with two non-dynamic bodies
This commit is contained in:
@ -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);
|
||||
|
||||
Reference in New Issue
Block a user