summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRémi Verschelde <rverschelde@gmail.com>2023-01-31 10:54:34 +0100
committerRémi Verschelde <rverschelde@gmail.com>2023-01-31 10:54:34 +0100
commitdfb824c1d1b2739cd956768b9228f34505db3650 (patch)
treef02f60acb3db95b58e6f88121dc3a22bdb3e1d48
parent93c3d3b5eba1acf1ec0fbbc1d9909da729019905 (diff)
parented54f4dce8c1d8811a37c3dedfcf200bd4d7e223 (diff)
Merge pull request #72107 from rburing/separation_ray_normal
Fix separation ray normal direction
-rw-r--r--servers/physics_3d/godot_collision_solver_3d.cpp5
1 files changed, 2 insertions, 3 deletions
diff --git a/servers/physics_3d/godot_collision_solver_3d.cpp b/servers/physics_3d/godot_collision_solver_3d.cpp
index fb5a67c008..2de1d86de1 100644
--- a/servers/physics_3d/godot_collision_solver_3d.cpp
+++ b/servers/physics_3d/godot_collision_solver_3d.cpp
@@ -127,11 +127,10 @@ bool GodotCollisionSolver3D::solve_separation_ray(const GodotShape3D *p_shape_A,
}
if (p_result_callback) {
+ Vector3 normal = (support_B - support_A).normalized();
if (p_swap_result) {
- Vector3 normal = (support_B - support_A).normalized();
- p_result_callback(support_B, 0, support_A, 0, normal, p_userdata);
+ p_result_callback(support_B, 0, support_A, 0, -normal, p_userdata);
} else {
- Vector3 normal = (support_A - support_B).normalized();
p_result_callback(support_A, 0, support_B, 0, normal, p_userdata);
}
}