private void RebuildFrustum(bool culling) { lock (PhysicsSimulation.Locker) { var ghost = _frustumGhost; if (ghost != null) { World?.Physics?.World.RemoveCollisionObject(ghost); _frustumGhost.Dispose(); _frustumShape.Dispose(); } if (!culling) { return; } MakeFrustumCollisionShape(out _frustumShape); _frustumGhost = new GhostObject { CollisionShape = _frustumShape, CollisionFlags = CollisionFlags.NoContactResponse }; World?.Physics?.World.AddCollisionObject(_frustumGhost); } }
public void TearDown() { world.RemoveRigidBody(body1); world.RemoveRigidBody(body2); boxShape.Dispose(); body1.MotionState.Dispose(); body2.MotionState.Dispose(); body1.Dispose(); body2.Dispose(); ghostObject.Dispose(); world.Dispose(); dispatcher.Dispose(); broadphase.Dispose(); conf.Dispose(); }
/// <inheritdoc/> public override void Destroy() { base.Destroy(); _ghostObject?.Dispose(); }