1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-12 13:20:55 +00:00

Check for motion in cast_motion() before doing Bullet convexSweepTest().

Also ensure that default closest_safe and closest_unsafe values are
defined in cast_motion() and before cast_motion() is called.
This commit is contained in:
Marcel Admiraal
2019-12-09 11:11:06 +01:00
parent 277d2f1f50
commit 8ffe905c45
3 changed files with 16 additions and 10 deletions

View File

@@ -295,7 +295,7 @@ Array PhysicsDirectSpaceState3D::_intersect_shape(const Ref<PhysicsShapeQueryPar
Array PhysicsDirectSpaceState3D::_cast_motion(const Ref<PhysicsShapeQueryParameters3D> &p_shape_query, const Vector3 &p_motion) {
ERR_FAIL_COND_V(!p_shape_query.is_valid(), Array());
float closest_safe, closest_unsafe;
float closest_safe = 1.0f, closest_unsafe = 1.0f;
bool res = cast_motion(p_shape_query->shape, p_shape_query->transform, p_motion, p_shape_query->margin, closest_safe, closest_unsafe, p_shape_query->exclude, p_shape_query->collision_mask, p_shape_query->collide_with_bodies, p_shape_query->collide_with_areas);
if (!res) {
return Array();