Beispiel #1
0
        internal DigitalRuneHingeJoint(HingeJointDescriptor descriptor)
        {
            WrappedHingeJoint = new HingeJoint();

            #region set RigidBodies
            if (!(descriptor.RigidBodyA is RigidBody))
            {
                throw new ArgumentException(String.Format("The type of the property 'RigidBodyA' must be '{0}'.", typeof(RigidBody)));
            }
            WrappedHingeJoint.BodyA = ((RigidBody)descriptor.RigidBodyA).WrappedRigidBody;
            _rigidBodyA             = descriptor.RigidBodyA;

            if (!(descriptor.RigidBodyB is RigidBody))
            {
                throw new ArgumentException("The type of the property 'RigidBodyB' must be 'System.Physics.DigitalRune.RigidBody'.");
            }
            WrappedHingeJoint.BodyB = ((RigidBody)descriptor.RigidBodyB).WrappedRigidBody;
            _rigidBodyB             = descriptor.RigidBodyB;
            #endregion
            WrappedHingeJoint.AnchorPoseALocal = descriptor.AnchorPoseALocal.ToDigitalRune();
            WrappedHingeJoint.AnchorPoseBLocal = descriptor.AnchorPoseBLocal.ToDigitalRune();
            WrappedHingeJoint.Maximum          = descriptor.MaximumAngle;
            WrappedHingeJoint.Minimum          = descriptor.MinimumAngle;

            Descriptor = descriptor;
        }
            public IHingeJoint Create(HingeJointDescriptor descriptor)
            {
                var constraint = new DigitalRuneHingeJoint(descriptor);

                _simulator._wrappedSimulation.Constraints.Add(constraint.WrappedHingeJoint);
                return(constraint);
            }
Beispiel #3
0
 public static IHingeJoint CreateHingeJoint(this IFactory <IConstraint> factory,
                                            HingeJointDescriptor descriptor)
 {
     return(factory.Create <IHingeJoint, HingeJointDescriptor>(descriptor));
 }
Beispiel #4
0
 public DefaultHingeJoint(HingeJointDescriptor descriptor)
 {
     Descriptor = descriptor;
 }