summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYuri Sizov <yuris@humnom.net>2023-12-22 17:19:48 +0100
committerYuri Sizov <yuris@humnom.net>2023-12-22 17:19:48 +0100
commit6b403712f1adc5e2ba96682bb163a7bd378ceb81 (patch)
treea8897af9a481de9bfd905e9adbadb55a2a39c4e2
parentbb1cdc1b2af4bfaa9aec7b430917cf808a58c810 (diff)
parente03a65fdea7a14bc319c6b957d958f1fb5d6aaa3 (diff)
downloadredot-engine-6b403712f1adc5e2ba96682bb163a7bd378ceb81.tar.gz
Merge pull request #83655 from golfinq/small-capsule-shape-fix
Replace confusing code in GodotCapsuleShape2D::get_supports
-rw-r--r--servers/physics_2d/godot_shape_2d.cpp3
1 files changed, 1 insertions, 2 deletions
diff --git a/servers/physics_2d/godot_shape_2d.cpp b/servers/physics_2d/godot_shape_2d.cpp
index dadd8173c6..2b3f496fc0 100644
--- a/servers/physics_2d/godot_shape_2d.cpp
+++ b/servers/physics_2d/godot_shape_2d.cpp
@@ -373,8 +373,7 @@ void GodotCapsuleShape2D::get_supports(const Vector2 &p_normal, Vector2 *r_suppo
if (h > 0 && Math::abs(n.x) > segment_is_valid_support_threshold) {
// make it flat
n.y = 0.0;
- n.normalize();
- n *= radius;
+ n.x = SIGN(n.x) * radius;
r_amount = 2;
r_supports[0] = n;