|
@@ -97,8 +97,13 @@ normal_relative_velocity(Body2DSW *a, Body2DSW *b, Vector2 rA, Vector2 rB, Vecto
|
|
}
|
|
}
|
|
|
|
|
|
bool PinJoint2DSW::setup(real_t p_step) {
|
|
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();
|
|
Space2DSW *space = A->get_space();
|
|
ERR_FAIL_COND_V(!space, false);
|
|
ERR_FAIL_COND_V(!space, false);
|
|
|
|
+
|
|
rA = A->get_transform().basis_xform(anchor_A);
|
|
rA = A->get_transform().basis_xform(anchor_A);
|
|
rB = B ? B->get_transform().basis_xform(anchor_B) : anchor_B;
|
|
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) {
|
|
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
|
|
// calculate endpoints in worldspace
|
|
Vector2 ta = A->get_transform().xform(A_groove_1);
|
|
Vector2 ta = A->get_transform().xform(A_groove_1);
|
|
Vector2 tb = A->get_transform().xform(A_groove_2);
|
|
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) {
|
|
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);
|
|
rA = A->get_transform().basis_xform(anchor_A);
|
|
rB = B->get_transform().basis_xform(anchor_B);
|
|
rB = B->get_transform().basis_xform(anchor_B);
|
|
|
|
|