/// <summary> /// Constructor. Do not use in system's OnCreate when simulation is Havok, as it won't pick up HavokConfiguration properly. /// </summary> public ImmediatePhysicsWorldStepper(SystemBase system, uint physicsWorldIndex) { SimulationContext = new SimulationContext(); #if HAVOK_PHYSICS_EXISTS Havok.Physics.HavokConfiguration config = system.HasSingleton <Havok.Physics.HavokConfiguration>() ? system.GetSingleton <Havok.Physics.HavokConfiguration>() : Havok.Physics.HavokConfiguration.Default; // We want to show different physics worlds in separate VDBs, so each one needs its own port config.VisualDebugger.Port += (int)physicsWorldIndex; HavokSimulationContext = new Havok.Physics.SimulationContext(config); #endif }
public static void EnsureHavok(SystemBase system) { if (system.HasSingleton <PhysicsStep>()) { var component = system.GetSingleton <PhysicsStep>(); if (component.SimulationType != SimulationType.HavokPhysics) { component.SimulationType = SimulationType.HavokPhysics; system.SetSingleton(component); } system.Enabled = false; } }