/// <summary> /// Called by the <see cref="LosgapSystem"/> when it is time for this module to 'tick'. At this point, the module should execute /// its logic for the current frame. /// </summary> /// <param name="parallelizationProvider">An object that facilitates multithreaded execution of state. Never null.</param> /// <param name="deltaMs">The time, in milliseconds, that has elapsed since the last invocation of this method.</param> void ILosgapModule.PipelineIterate(ParallelizationProvider parallelizationProvider, long deltaMs) { float deltaSecs = deltaMs * 0.001f; bool pausePhysicsLocal; lock (staticMutationLock) { foreach (var toBeAdded in entitiesToBeAdded) { entityList.Add(toBeAdded); } foreach (var toBeRemoved in entitiesToBeRemoved) { entityList.Remove(toBeRemoved); } entitiesToBeRemoved.Clear(); entitiesToBeAdded.Clear(); pausePhysicsLocal = pausePhysics; } if (!pausePhysicsLocal) { PhysicsManager.Tick(deltaSecs); PhysicsManager.GetCollisionPairs(collisionPairList); lock (staticMutationLock) { foreach (KVP <PhysicsBodyHandle, PhysicsBodyHandle> pair in collisionPairList) { if (KeyContainedInCRB(pair.Key)) { Entity other = null; if (KeyContainedInCRB(pair.Value)) { other = collisionReportableBodies[pair.Value]; } else { for (int i = 0; i < entityList.Count; ++i) { if (entityList[i].PhysicsBody == pair.Value) { other = entityList[i]; break; } } } if (other != null) { collisionReportableBodies[pair.Key].TouchDetected(other); } } if (KeyContainedInCRB(pair.Value)) { Entity other = null; if (KeyContainedInCRB(pair.Key)) { other = collisionReportableBodies[pair.Key]; } else { for (int i = 0; i < entityList.Count; ++i) { if (entityList[i].PhysicsBody == pair.Key) { other = entityList[i]; break; } } } if (other != null) { collisionReportableBodies[pair.Value].TouchDetected(other); } } } } } for (int i = 0; i < entityList.Count; ++i) { entityList[i].SynchronizedTick(deltaSecs); } OnPostTick(deltaSecs); elapsedTime += deltaSecs; }
public void Dispose() { PhysicsManager.DestroyConstraint(this); }
public void Dispose() { Assure.NotEqual(this, NULL); PhysicsManager.DestroyRigidBody(this); }
public void Dispose() { PhysicsManager.DestroyShape(this); }