diff options
author | RĂ©mi Verschelde <rverschelde@gmail.com> | 2020-06-21 18:05:02 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-06-21 18:05:02 +0200 |
commit | 858af3d3b96bd0d27158b5a3c01fabe59bbe015a (patch) | |
tree | 4ea044645e52a78e55c8558b482e0bd4e76b5d1f /scene/3d/camera_3d.cpp | |
parent | fd21465ec309cb84cd262c110fe59d8060c37f82 (diff) | |
parent | 8ffe905c455eaa33394dafe67858df12d767fc27 (diff) |
Merge pull request #34219 from madmiraal/check-motion-before-bullet-sweep
Check for motion in cast_motion() before doing Bullet convexSweepTest().
Diffstat (limited to 'scene/3d/camera_3d.cpp')
-rw-r--r-- | scene/3d/camera_3d.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/scene/3d/camera_3d.cpp b/scene/3d/camera_3d.cpp index 8dc5cd4aba..7ffca4bd9e 100644 --- a/scene/3d/camera_3d.cpp +++ b/scene/3d/camera_3d.cpp @@ -754,9 +754,9 @@ void ClippedCamera3D::_notification(int p_what) { xf.origin = ray_from; xf.orthonormalize(); - float csafe, cunsafe; - if (dspace->cast_motion(pyramid_shape, xf, cam_pos - ray_from, margin, csafe, cunsafe, exclude, collision_mask, clip_to_bodies, clip_to_areas)) { - clip_offset = cam_pos.distance_to(ray_from + (cam_pos - ray_from) * csafe); + float closest_safe = 1.0f, closest_unsafe = 1.0f; + if (dspace->cast_motion(pyramid_shape, xf, cam_pos - ray_from, margin, closest_safe, closest_unsafe, exclude, collision_mask, clip_to_bodies, clip_to_areas)) { + clip_offset = cam_pos.distance_to(ray_from + (cam_pos - ray_from) * closest_safe); } _update_camera(); |