#Unable to receive collision events

1 messages · Page 1 of 1 (latest)

heady pewter
#

Unity: 6000.4.0b2
Entities: 6.4.0
Entity Physics: 1.4.3

Somehow I am not getting any physics collision events, I've tried putting it in different groups in different orders in the Fixed Step Simulation group and Physics System Group. I ofcourse have a rigidbody and have confirmed that the system is firing. I am just not getting any collision events.

Does anyone know why this is?

Code:

[UpdateInGroup(typeof(PhysicsSystemGroup))]
[UpdateAfter(typeof(PhysicsSimulationGroup))]
public partial struct AddDeadTagOnImpactSystem : ISystem {
        
    private ComponentLookup<DeadTagOnImpact> deadTagOnImpactLookup;
        
    [BurstCompile]
    public void OnCreate(ref SystemState state) {
        state.RequireForUpdate<SimulationSingleton>();
        state.RequireForUpdate<EndFixedStepSimulationEntityCommandBufferSystem.Singleton>();

        deadTagOnImpactLookup = state.GetComponentLookup<DeadTagOnImpact>(true);
    }

    // [BurstCompile]
    public void OnUpdate(ref SystemState state) {
        SimulationSingleton simulationSingleton = SystemAPI.GetSingleton<SimulationSingleton>();
        EntityCommandBuffer ecb = SystemAPI.GetSingleton<EndFixedStepSimulationEntityCommandBufferSystem.Singleton>().CreateCommandBuffer(state.WorldUnmanaged);
            
        deadTagOnImpactLookup.Update(ref state);
            
        state.Dependency = new ApplyDeadTagJob { ecb = ecb, deadTagOnImpactLookup = deadTagOnImpactLookup }
           .Schedule(simulationSingleton, state.Dependency);
    }

    // [BurstCompile]
    public partial struct ApplyDeadTagJob : ICollisionEventsJob {
        public EntityCommandBuffer ecb;
            
        [ReadOnly] public ComponentLookup<DeadTagOnImpact> deadTagOnImpactLookup;
            
        public void Execute(CollisionEvent collisionEvent) {
            Debug.Log("Collision");
            // ...
        }
    }
}