From 3d4be5d4c2469a2a242599f805fd0282c2e25620 Mon Sep 17 00:00:00 2001 From: Ricardo Buring Date: Sun, 20 Mar 2022 10:31:03 +0100 Subject: [PATCH] Raycasts hitting from inside: return collision point in global coordinates --- servers/physics_2d/godot_space_2d.cpp | 2 +- servers/physics_3d/godot_space_3d.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/servers/physics_2d/godot_space_2d.cpp b/servers/physics_2d/godot_space_2d.cpp index 04b8d3c7418..99c0566fb11 100644 --- a/servers/physics_2d/godot_space_2d.cpp +++ b/servers/physics_2d/godot_space_2d.cpp @@ -158,7 +158,7 @@ bool GodotPhysicsDirectSpaceState2D::intersect_ray(const RayParameters &p_parame if (p_parameters.hit_from_inside) { // Hit shape at starting point. min_d = 0; - res_point = local_from; + res_point = begin; res_normal = Vector2(); res_shape = shape_idx; res_obj = col_obj; diff --git a/servers/physics_3d/godot_space_3d.cpp b/servers/physics_3d/godot_space_3d.cpp index e28b6da0d98..e8af2d7283f 100644 --- a/servers/physics_3d/godot_space_3d.cpp +++ b/servers/physics_3d/godot_space_3d.cpp @@ -153,7 +153,7 @@ bool GodotPhysicsDirectSpaceState3D::intersect_ray(const RayParameters &p_parame if (p_parameters.hit_from_inside) { // Hit shape at starting point. min_d = 0; - res_point = local_from; + res_point = begin; res_normal = Vector3(); res_shape = shape_idx; res_obj = col_obj;