I have
[UpdateInGroup(typeof(FixedStepSimulationSystemGroup))]
[UpdateAfter(typeof(ExportPhysicsWorld))]
[UpdateBefore(typeof(EndFramePhysicsSystem))]
public partial class SphereCollisionSystem : SystemBase
{
BuildPhysicsWorld buildPhysicsWorldSystem;
StepPhysicsWorld stepPhysicsWorldSystem;
protected override void OnCreate()
{
buildPhysicsWorldSystem = World.DefaultGameObjectInjectionWorld.GetOrCreateSystem<BuildPhysicsWorld>();
stepPhysicsWorldSystem = World.DefaultGameObjectInjectionWorld.GetOrCreateSystem<StepPhysicsWorld>();
}
[BurstCompile]
private struct CollisionEventJob : ICollisionEventsJob
{
[ReadOnly]public PhysicsWorld physicsWorld;
public void Execute(CollisionEvent collisionEvent)
{
Entity entityA = collisionEvent.EntityA;
Entity entityB = collisionEvent.EntityB;
CollisionEvent.Details collisionDetails = collisionEvent.CalculateDetails(ref physicsWorld);
Debug.Log(string.Format("{0}", collisionDetails.EstimatedContactPointPositions[0]));
}
}
protected override void OnStartRunning()
{
this.RegisterPhysicsRuntimeSystemReadOnly();
}
protected override void OnUpdate()
{
JobHandle collisionJobHandle = new CollisionEventJob()
{
physicsWorld = buildPhysicsWorldSystem.PhysicsWorld
}.Schedule(stepPhysicsWorldSystem.Simulation, this.Dependency);
collisionJobHandle.Complete();
}
}
How to access Translations of EntityA and EntityB inside job?