Allow kinematic bodies without shapes to still move, fixes #24775
This commit is contained in:
parent
9ae86e90f9
commit
f439b786ea
4 changed files with 20 additions and 0 deletions
|
@ -717,6 +717,11 @@ bool SpaceSW::test_body_motion(BodySW *p_body, const Transform &p_from, const Ve
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!shapes_found) {
|
if (!shapes_found) {
|
||||||
|
if (r_result) {
|
||||||
|
*r_result = PhysicsServer::MotionResult();
|
||||||
|
r_result->motion = p_motion;
|
||||||
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -704,6 +704,10 @@ bool Space2DSW::test_body_motion(Body2DSW *p_body, const Transform2D &p_from, co
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!shapes_found) {
|
if (!shapes_found) {
|
||||||
|
if (r_result) {
|
||||||
|
*r_result = Physics2DServer::MotionResult();
|
||||||
|
r_result->motion = p_motion;
|
||||||
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -504,6 +504,12 @@ public:
|
||||||
RID collider;
|
RID collider;
|
||||||
int collider_shape;
|
int collider_shape;
|
||||||
Variant collider_metadata;
|
Variant collider_metadata;
|
||||||
|
|
||||||
|
MotionResult() {
|
||||||
|
collision_local_shape = 0;
|
||||||
|
collider_shape = 0;
|
||||||
|
collider_id = 0;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
virtual bool body_test_motion(RID p_body, const Transform2D &p_from, const Vector2 &p_motion, bool p_infinite_inertia, float p_margin = 0.001, MotionResult *r_result = NULL, bool p_exclude_raycast_shapes = true) = 0;
|
virtual bool body_test_motion(RID p_body, const Transform2D &p_from, const Vector2 &p_motion, bool p_infinite_inertia, float p_margin = 0.001, MotionResult *r_result = NULL, bool p_exclude_raycast_shapes = true) = 0;
|
||||||
|
|
|
@ -492,6 +492,11 @@ public:
|
||||||
RID collider;
|
RID collider;
|
||||||
int collider_shape;
|
int collider_shape;
|
||||||
Variant collider_metadata;
|
Variant collider_metadata;
|
||||||
|
MotionResult() {
|
||||||
|
collision_local_shape = 0;
|
||||||
|
collider_id = 0;
|
||||||
|
collider_shape = 0;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
virtual bool body_test_motion(RID p_body, const Transform &p_from, const Vector3 &p_motion, bool p_infinite_inertia, MotionResult *r_result = NULL, bool p_exclude_raycast_shapes = true) = 0;
|
virtual bool body_test_motion(RID p_body, const Transform &p_from, const Vector3 &p_motion, bool p_infinite_inertia, MotionResult *r_result = NULL, bool p_exclude_raycast_shapes = true) = 0;
|
||||||
|
|
Loading…
Reference in a new issue