Пример #1
0
        public SimulationContext(HavokConfiguration config)
        {
            // Unlock the plugin if it hasn't already been done.
            // If it remains locked, the simulation will do nothing.
            Plugin.EnsureUnlocked();

            TimeStep        = default;
            InputVelocities = default;

            Camera = default;

            unsafe
            {
                // Allocate this at a fixed memory location. The plugin writes to it.
                StepContext = (HavokSimulation.StepContext *)UnsafeUtility.Malloc(sizeof(HavokSimulation.StepContext), 16, Allocator.Persistent);
                UnsafeUtility.MemClear(StepContext, sizeof(HavokSimulation.StepContext));

                VisualDebuggerEnabled = config.VisualDebugger.Enable != 0;
                WorldIndex            = Plugin.HP_AllocateWorld(ref config, StepContext);
                m_WorldAllocated      = true;
            }

            HaveStaticBodiesChanged = default;
            StaticBodiesSyncedOnce  = false;
        }
Пример #2
0
 internal static extern unsafe int HP_StepWorld(int worldIndex, ref HavokSimulation.StepInput input, HavokSimulation.StepContext *context);
Пример #3
0
 internal static extern unsafe int HP_AllocateWorld(ref HavokConfiguration config, HavokSimulation.StepContext *stepContext);