fix: collider2Ds not updating collider after new assignment
This commit is contained in:
@@ -6,11 +6,20 @@ namespace Syntriax.Engine.Physics2D;
|
||||
public class Collider2DShapeBehaviour : Collider2DBehaviourBase, IShapeCollider2D
|
||||
{
|
||||
public Shape2D ShapeWorld { get => _shapeWorld; protected set => _shapeWorld = value; }
|
||||
public Shape2D ShapeLocal { get; set; } = Shape2D.Square;
|
||||
public Shape2D ShapeLocal
|
||||
{
|
||||
get => _shapeLocal;
|
||||
set
|
||||
{
|
||||
_shapeLocal = value;
|
||||
NeedsRecalculation = true;
|
||||
}
|
||||
}
|
||||
|
||||
private Shape2D _shapeWorld = Shape2D.Square.CreateCopy();
|
||||
private Shape2D _shapeWorld = Shape2D.Square;
|
||||
private Shape2D _shapeLocal = Shape2D.Square;
|
||||
|
||||
public override void CalculateCollider() => Transform.TransformShape(ShapeLocal, ref _shapeWorld);
|
||||
public override void CalculateCollider() => ShapeLocal.Transform(Transform, ref _shapeWorld);
|
||||
|
||||
public Collider2DShapeBehaviour() { }
|
||||
public Collider2DShapeBehaviour(Shape2D shape)
|
||||
|
||||
Reference in New Issue
Block a user