1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-10 13:00:37 +00:00

Fix WorldBoundaryShape2D handle when distance is negative

This commit is contained in:
Haoyu Qiu
2025-06-04 08:43:35 +08:00
parent 1b37dacc18
commit 73002a6c2c

View File

@@ -184,7 +184,8 @@ void CollisionShape2DEditor::set_handle(int idx, Point2 &p_point) {
Vector2 normal = world_boundary->get_normal(); Vector2 normal = world_boundary->get_normal();
world_boundary->set_distance(p_point.dot(normal) / normal.length_squared()); world_boundary->set_distance(p_point.dot(normal) / normal.length_squared());
} else { } else {
world_boundary->set_normal(p_point.normalized()); real_t dir = world_boundary->get_distance() < 0 ? -1 : 1;
world_boundary->set_normal(p_point.normalized() * dir);
} }
} }
} break; } break;