diff --git a/ShipCombatCore/ShipCombatCore.csproj b/ShipCombatCore/ShipCombatCore.csproj index 33b6284..5eea68a 100644 --- a/ShipCombatCore/ShipCombatCore.csproj +++ b/ShipCombatCore/ShipCombatCore.csproj @@ -6,7 +6,7 @@ netstandard2.1 Martin Evans - 23.0.0 + 24.0.0 diff --git a/ShipCombatCore/Simulation/Behaviours/SphereColliderPrimary.cs b/ShipCombatCore/Simulation/Behaviours/SphereColliderPrimary.cs index aa1726f..4ddad46 100644 --- a/ShipCombatCore/Simulation/Behaviours/SphereColliderPrimary.cs +++ b/ShipCombatCore/Simulation/Behaviours/SphereColliderPrimary.cs @@ -30,7 +30,7 @@ public class SphereColliderPrimary private readonly HashSet _queryResults = new(); - public BoundingBox Bounds => new(new BoundingSphere(Position, Radius)); + public BoundingBox Bounds { get; private set; } public override void Initialise(INamedDataProvider? initialisationData) { @@ -40,6 +40,11 @@ public override void Initialise(INamedDataProvider? initialisationData) _secondaryManager = Owner.Scene!.GetManager(); } + protected void InitialiseBounds() + { + Bounds = new(new BoundingSphere(Position, Radius)); + } + public override void CreateProperties(Entity.ConstructionContext context) { _radius = context.CreateProperty(PropertyNames.SphereRadius); @@ -95,6 +100,7 @@ public override void Add(SphereColliderPrimary behaviour) { base.Add(behaviour); + behaviour.InitialiseBounds(); var min = ToBucket(behaviour.Bounds.Min); var max = ToBucket(behaviour.Bounds.Max); diff --git a/SpaceShipCombatSimulator/SpaceShipCombatSimulator.csproj b/SpaceShipCombatSimulator/SpaceShipCombatSimulator.csproj index 36973e7..2562a4a 100644 --- a/SpaceShipCombatSimulator/SpaceShipCombatSimulator.csproj +++ b/SpaceShipCombatSimulator/SpaceShipCombatSimulator.csproj @@ -4,7 +4,7 @@ enable Exe net5.0 - 23.0.0 + 24.0.0