コード例 #1
0
        internal DigitalRunePointOnPlaneJoint(PointOnPlaneJointDescriptor descriptor)
        {
            WrappedPointOnPlaneJoint = new PointOnPlaneConstraint();

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

            var actualMinimumX = WrappedPointOnPlaneJoint.Minimum;
            actualMinimumX[0] = descriptor.MinimumDistanceX;
            WrappedPointOnPlaneJoint.Minimum = actualMinimumX;

            var actualMaximumX = WrappedPointOnPlaneJoint.Maximum;
            actualMaximumX[0] = descriptor.MaximumDistanceX;
            WrappedPointOnPlaneJoint.Maximum = actualMaximumX;

            var actualMaximumY = WrappedPointOnPlaneJoint.Maximum;
            actualMaximumY[1] = descriptor.MaximumDistanceY;
            WrappedPointOnPlaneJoint.Maximum = actualMaximumY;

            var actualMinimumY = WrappedPointOnPlaneJoint.Minimum;
            actualMinimumY[1] = descriptor.MinimumDistanceY;
            WrappedPointOnPlaneJoint.Minimum = actualMinimumY;


            Descriptor = descriptor;
        }
コード例 #2
0
 public static IPointOnPlaneJoint CreatePointOnPlaneJoint(this IFactory<IConstraint> factory,
                                    PointOnPlaneJointDescriptor descriptor)
 {
     return factory.Create<IPointOnPlaneJoint, PointOnPlaneJointDescriptor>(descriptor);
 }
コード例 #3
0
 public DefaultPointOnPlaneJoint(PointOnPlaneJointDescriptor descriptor)
 {
     Descriptor = descriptor;
 }