示例#1
0
        private void CreatePhantomConstraint()
        {
            if (this.m_phantomConstraint != null)
            {
                this.DisposePhantomContraint(null);
            }
            MyGridPhysics bodyA   = base.CubeGrid.Physics;
            MyPhysicsBody physics = base.Physics;

            if (((bodyA != null) && (physics != null)) && physics.Enabled)
            {
                HkFixedConstraintData data = new HkFixedConstraintData();
                data.SetInBodySpace(base.PositionComp.LocalMatrix, Matrix.CreateTranslation(-physics.Center), bodyA, physics);
                this.m_phantomConstraint = new HkConstraint(bodyA.RigidBody, physics.RigidBody, data);
                bodyA.AddConstraint(this.m_phantomConstraint);
            }
        }