protected override void OnCreate() { base.OnCreate(); WorldFilter = new PhysicsWorldIndex(1); PhysicsData = new PhysicsWorldData(EntityManager, WorldFilter); }
protected override void OnCreate() { base.OnCreate(); WorldFilter = new PhysicsWorldIndex(3); PhysicsData = new PhysicsWorldData(EntityManager, WorldFilter); // Declare read/write access to Server entities' PhysicsColliders // Theoretically, colliders we need here (in Server world) could be changed from PhysicsCollider component on any Entity (since colliders are usually shared between entities), // but we're assuming that server and client-only bodies don't share colliders and that ghost Main world entities will never be changed (they're just server replicas). m_PhysicsColliderQuery = EntityManager.CreateEntityQuery(new EntityQueryDesc { All = new ComponentType[] { typeof(PhysicsCollider), typeof(PhysicsWorldIndex) } }); m_PhysicsColliderQuery.SetSharedComponentFilter(WorldFilter); // Make sure ServerPhysicsSystemRuntimeData is registered as singleton, so we can use it to control client physics world access var runtimeDataEntity = EntityManager.CreateEntity(); EntityManager.AddComponentData(runtimeDataEntity, new ServerPhysicsSystemRuntimeData()); m_Stepper = new PhysicsWorldStepper(); }