コード例 #1
0
        internal override void createProduct(Engine.ObjectManagement.SimObjectBase instance, BulletScene scene)
        {
            RigidBody rbA = null;
            RigidBody rbB = null;

            SimObject other = instance.getOtherSimObject(RigidBodyASimObject);

            if (other != null)
            {
                rbA = other.getElement(RigidBodyAElement) as RigidBody;
            }

            other = instance.getOtherSimObject(RigidBodyBSimObject);
            if (other != null)
            {
                rbB = other.getElement(RigidBodyBElement) as RigidBody;
            }

            TypedConstraintElement element = createConstraint(rbA, rbB, instance, scene);

            if (element != null)
            {
                instance.addElement(element);
            }
        }
コード例 #2
0
        protected override void Dispose()
        {
            if (rigidBody != IntPtr.Zero)
            {
                int numRefs = btRigidBody_getNumConstraintRefs(rigidBody);
                List <TypedConstraintElement> constraints = new List <TypedConstraintElement>(numRefs);
                //Gather up all constraints
                for (int i = 0; i < numRefs; ++i)
                {
                    IntPtr typedConstraint         = btRigidBody_getConstraintRef(rigidBody, i);
                    TypedConstraintElement element = TypedConstraintManager.getElement(typedConstraint);
                    if (element != null)
                    {
                        constraints.Add(element);
                    }
                }
                //Set all constraints to inactive
                foreach (TypedConstraintElement constraint in constraints)
                {
                    constraint.setInactive();
                }

                if (Owner.Enabled)
                {
                    scene.removeRigidBody(this);
                }

                RigidBodyManager.remove(rigidBody);

                btRigidBody_Delete(rigidBody);
                rigidBody = IntPtr.Zero;

                motionState.Dispose();
            }
        }
コード例 #3
0
 internal void removeConstraint(TypedConstraintElement constraint)
 {
     BulletScene_removeConstraint(bulletScene, constraint.constraint);
 }
コード例 #4
0
 internal void addConstraint(TypedConstraintElement constraint, bool disableCollisionsBetweenLinkedBodies)
 {
     BulletScene_addConstraint(bulletScene, constraint.constraint, disableCollisionsBetweenLinkedBodies);
 }
コード例 #5
0
 public static void addConstraint(IntPtr ptr, TypedConstraintElement element)
 {
     constraintMap.Add(ptr, element);
 }