From 66b46e3d36571d08e4b40f544cc85ed6e117acd7 Mon Sep 17 00:00:00 2001 From: Syntriax Date: Mon, 7 Apr 2025 22:37:23 +0300 Subject: [PATCH] fix: 2D shape collider parametered constructor not creating a copy of the given shape --- Engine.Physics2D/Collider2DShapeBehaviour.cs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Engine.Physics2D/Collider2DShapeBehaviour.cs b/Engine.Physics2D/Collider2DShapeBehaviour.cs index 38b455e..178d490 100644 --- a/Engine.Physics2D/Collider2DShapeBehaviour.cs +++ b/Engine.Physics2D/Collider2DShapeBehaviour.cs @@ -13,5 +13,9 @@ public class Collider2DShapeBehaviour : Collider2DBehaviourBase, IShapeCollider2 public override void CalculateCollider() => Transform.TransformShape(ShapeLocal, ref _shapeWorld); public Collider2DShapeBehaviour() { } - public Collider2DShapeBehaviour(Shape2D shape) => ShapeLocal = shape; + public Collider2DShapeBehaviour(Shape2D shape) + { + ShapeLocal = shape; + ShapeWorld.CreateCopy(); + } }