internal DigitalRuneSphericalJoint(SphericalJointDescriptor descriptor)
        {
            WrappedSphericalJoint = new BallJoint();

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

            Descriptor = descriptor;
        }
Пример #2
0
 public static ISphericalJoint CreateSphericalJoint(this IFactory<IConstraint> factory,
                                    SphericalJointDescriptor descriptor)
 {
     return factory.Create<ISphericalJoint, SphericalJointDescriptor>(descriptor);
 }
 public DefaultSphericalJoint(SphericalJointDescriptor descriptor)
 {
     Descriptor = descriptor;
 }