summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRicardo Buring <ricardo.buring@gmail.com>2023-03-13 13:54:10 +0100
committerYuri Sizov <yuris@humnom.net>2023-03-27 16:22:22 +0200
commitd8f0c2bdca653b4a1ec5ef3d173d798efc5005b2 (patch)
tree21899a5f0fab087348998f6f5ec52fe32850f344
parentcacf49999e3fb37281d66cc591ca8bebc5712d4d (diff)
Revert attempted fix of trimesh CCD
(cherry picked from commit bec1182093febd37362766d67b6e78895343434a)
-rw-r--r--servers/physics_3d/godot_body_pair_3d.cpp15
1 files changed, 4 insertions, 11 deletions
diff --git a/servers/physics_3d/godot_body_pair_3d.cpp b/servers/physics_3d/godot_body_pair_3d.cpp
index 3a91e5e480..292563b6ab 100644
--- a/servers/physics_3d/godot_body_pair_3d.cpp
+++ b/servers/physics_3d/godot_body_pair_3d.cpp
@@ -237,17 +237,10 @@ bool GodotBodyPair3D::_test_ccd(real_t p_step, GodotBody3D *p_A, int p_shape_A,
Vector3 hitpos = p_xform_B.xform(segment_hit_local);
real_t newlen = hitpos.distance_to(supports_A[segment_support_idx]);
- if (shape_B_ptr->is_concave()) {
- // Subtracting 5% of body length from the distance between collision and support point
- // should cause body A's support point to arrive just before a face of B next frame.
- newlen = MAX(newlen - (max - min) * 0.05, 0.0);
- // NOTE: This may stop body A completely, without a proper collision response.
- // We consider this preferable to tunneling.
- } else {
- // Adding 1% of body length to the distance between collision and support point
- // should cause body A's support point to arrive just within B's collider next frame.
- newlen += (max - min) * 0.01;
- }
+ // Adding 1% of body length to the distance between collision and support point
+ // should cause body A's support point to arrive just within B's collider next frame.
+ newlen += (max - min) * 0.01;
+ // FIXME: This doesn't always work well when colliding with a triangle face of a trimesh shape.
p_A->set_linear_velocity((mnormal * newlen) / p_step);