Exemplo n.º 1
0
        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);
            }
        }
Exemplo n.º 2
0
        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();
        }
Exemplo n.º 3
0
 /// <inheritdoc/>
 public override void Destroy()
 {
     base.Destroy();
     _ghostObject?.Dispose();
 }