diff --git a/src/Murder/Systems/Physics/QuadtreeCalculatorSystem.cs b/src/Murder/Systems/Physics/QuadtreeCalculatorSystem.cs index 6c0e77cc..e9b682b8 100644 --- a/src/Murder/Systems/Physics/QuadtreeCalculatorSystem.cs +++ b/src/Murder/Systems/Physics/QuadtreeCalculatorSystem.cs @@ -15,7 +15,7 @@ namespace Murder.Systems; [Filter(typeof(ColliderComponent), typeof(ITransformComponent))] [Watch(typeof(ITransformComponent), typeof(ColliderComponent))] -public class QuadtreeCalculatorSystem : IReactiveSystem, IFixedUpdateSystem, IStartupSystem +public class QuadtreeCalculatorSystem : IReactiveSystem, IStartupSystem { private readonly HashSet _entitiesOnWatch = new(516); @@ -58,17 +58,17 @@ public void OnDeactivated(World world, ImmutableArray entities) } } - public void FixedUpdate(Context context) + public void OnAfterTrigger(World world) { if (_entitiesOnWatch.Count == 0) { return; } - Quadtree qt = Quadtree.GetOrCreateUnique(context.World); + Quadtree qt = Quadtree.GetOrCreateUnique(world); foreach (int entityId in _entitiesOnWatch) { - if (context.World.TryGetEntity(entityId) is Entity entity && entity.IsActive) + if (world.TryGetEntity(entityId) is Entity entity && entity.IsActive) { qt.RemoveFromCollisionQuadTree(entityId); qt.AddToCollisionQuadTree(entity); diff --git a/src/Murder/Systems/Physics/TriggerPhysicsSystem.cs b/src/Murder/Systems/Physics/TriggerPhysicsSystem.cs index 4b85a9c9..26523df0 100644 --- a/src/Murder/Systems/Physics/TriggerPhysicsSystem.cs +++ b/src/Murder/Systems/Physics/TriggerPhysicsSystem.cs @@ -8,6 +8,7 @@ using Murder.Services; using Murder.Utilities; using System.Collections.Immutable; +using System.Diagnostics; namespace Murder.Systems.Physics { @@ -28,6 +29,7 @@ private void WatchEntities(ImmutableArray entities, World world) for (int i = 0; i < entities.Length; i++) { Entity entity = entities[i]; + if (_entitiesOnWatch.ContainsKey(entity.EntityId)) { continue;