summaryrefslogtreecommitdiff
path: root/scene/main
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <remi@verschelde.fr>2021-11-01 21:01:44 +0100
committerGitHub <noreply@github.com>2021-11-01 21:01:44 +0100
commit96ce806b2f2797fd27a0d40738ee5be6bc30b0aa (patch)
treee9898f32d1db0d9516c4a9ab116b6e80b75ce5d9 /scene/main
parenta57de3b81849a4cb5eadcccb837d787c7744ab8b (diff)
parent02b6bbc5df079131eaa98925d299b7a328800583 (diff)
Merge pull request #54369 from S0yKaf/fix-hardcoded-ray-distance
Fix hardcoded raycast distance in viewport object picking
Diffstat (limited to 'scene/main')
-rw-r--r--scene/main/viewport.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/scene/main/viewport.cpp b/scene/main/viewport.cpp
index 6388b375d9..cdf1f495e4 100644
--- a/scene/main/viewport.cpp
+++ b/scene/main/viewport.cpp
@@ -715,10 +715,11 @@ void Viewport::_process_picking() {
if (camera_3d) {
Vector3 from = camera_3d->project_ray_origin(pos);
Vector3 dir = camera_3d->project_ray_normal(pos);
+ real_t far = camera_3d->far;
PhysicsDirectSpaceState3D *space = PhysicsServer3D::get_singleton()->space_get_direct_state(find_world_3d()->get_space());
if (space) {
- bool col = space->intersect_ray(from, from + dir * 10000, result, Set<RID>(), 0xFFFFFFFF, true, true, true);
+ bool col = space->intersect_ray(from, from + dir * far, result, Set<RID>(), 0xFFFFFFFF, true, true, true);
ObjectID new_collider;
if (col) {
CollisionObject3D *co = Object::cast_to<CollisionObject3D>(result.collider);