diff options
author | Marcel Admiraal <madmiraal@users.noreply.github.com> | 2020-11-27 14:33:10 +0000 |
---|---|---|
committer | Marcel Admiraal <madmiraal@users.noreply.github.com> | 2020-11-27 15:33:00 +0000 |
commit | 356a2b72353ea8a0e7d3319834ff1de689d8f94c (patch) | |
tree | b1c4dfc69ff3b0ca4d79a5e93bac16d0ac26d812 /modules/bullet | |
parent | e5ff2d0ffd2edd61f51f95054880c5b943c3c855 (diff) |
Fix cast_motion sometimes failing
- Fixes Godot physics failing when the cast Shape is inside of, or
already colliding with another Shape.
- Fixes Bullet physics failing when there is no motion.
- Ensures Godot and Bullet physics behave the same.
- Updates the documentation to exclude the caveats for the failures and
differences.
Diffstat (limited to 'modules/bullet')
-rw-r--r-- | modules/bullet/space_bullet.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/modules/bullet/space_bullet.cpp b/modules/bullet/space_bullet.cpp index abad1beacb..bb5482e2b0 100644 --- a/modules/bullet/space_bullet.cpp +++ b/modules/bullet/space_bullet.cpp @@ -177,8 +177,10 @@ bool BulletPhysicsDirectSpaceState::cast_motion(const RID &p_shape, const Transf bt_xform_to.getOrigin() += bt_motion; if ((bt_xform_to.getOrigin() - bt_xform_from.getOrigin()).fuzzyZero()) { + r_closest_safe = 1.0f; + r_closest_unsafe = 1.0f; bulletdelete(btShape); - return false; + return true; } GodotClosestConvexResultCallback btResult(bt_xform_from.getOrigin(), bt_xform_to.getOrigin(), &p_exclude, p_collide_with_bodies, p_collide_with_areas); |