浏览代码

Raycasts hitting from inside: return collision point in global coordinates

Ricardo Buring 3 年之前
父节点
当前提交
3d4be5d4c2
共有 2 个文件被更改,包括 2 次插入2 次删除
  1. 1 1
      servers/physics_2d/godot_space_2d.cpp
  2. 1 1
      servers/physics_3d/godot_space_3d.cpp

+ 1 - 1
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) {
 			if (p_parameters.hit_from_inside) {
 				// Hit shape at starting point.
 				// Hit shape at starting point.
 				min_d = 0;
 				min_d = 0;
-				res_point = local_from;
+				res_point = begin;
 				res_normal = Vector2();
 				res_normal = Vector2();
 				res_shape = shape_idx;
 				res_shape = shape_idx;
 				res_obj = col_obj;
 				res_obj = col_obj;

+ 1 - 1
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) {
 			if (p_parameters.hit_from_inside) {
 				// Hit shape at starting point.
 				// Hit shape at starting point.
 				min_d = 0;
 				min_d = 0;
-				res_point = local_from;
+				res_point = begin;
 				res_normal = Vector3();
 				res_normal = Vector3();
 				res_shape = shape_idx;
 				res_shape = shape_idx;
 				res_obj = col_obj;
 				res_obj = col_obj;