internal DigitalRuneDistanceRangeJoint(DistanceRangeJointDescriptor descriptor)
        {
            WrappedDistanceRangeJoint = new DistanceLimit();

            #region set RigidBodies
            if (!(descriptor.RigidBodyA is RigidBody))
                throw new ArgumentException(String.Format("The type of the property 'RigidBodyA' must be '{0}'.", typeof(RigidBody)));
            WrappedDistanceRangeJoint.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'.");
            WrappedDistanceRangeJoint.BodyB = ((RigidBody)descriptor.RigidBodyB).WrappedRigidBody;
            _rigidBodyB = descriptor.RigidBodyB;
            #endregion
            WrappedDistanceRangeJoint.AnchorPositionALocal = descriptor.AnchorPositionALocal.ToDigitalRune();
            WrappedDistanceRangeJoint.AnchorPositionBLocal = descriptor.AnchorPositionBLocal.ToDigitalRune();
            WrappedDistanceRangeJoint.MinDistance = descriptor.MinimumDistance;
            WrappedDistanceRangeJoint.MaxDistance = descriptor.MaximumDistance;

            Descriptor = descriptor;
        }
Esempio n. 2
0
 public static IDistanceRangeJoint CreateDistanceRangeJoint(this IFactory<IConstraint> factory,
                               DistanceRangeJointDescriptor descriptor)
 {
     return factory.Create<IDistanceRangeJoint, DistanceRangeJointDescriptor>(descriptor);
 }
 public DefaultDistanceRangeJoint(DistanceRangeJointDescriptor descriptor)
 {
     Descriptor = descriptor;
 }