Class UniversalJoint
- Namespace
- Jitter2.Dynamics.Constraints
- Assembly
- Jitter2.dll
Connects two bodies at a shared anchor, allowing rotation about two axes while constraining twist. Supports an optional motor or servo.
public class UniversalJoint : Joint, IDebugDrawable
- Inheritance
-
UniversalJoint
- Implements
- Inherited Members
Constructors
UniversalJoint(World, RigidBody, RigidBody, JVector, JVector, JVector, JointDrive)
Initializes a new universal joint.
public UniversalJoint(World world, RigidBody body1, RigidBody body2, JVector center, JVector rotateAxis1, JVector rotateAxis2, JointDrive drive = JointDrive.None)
Parameters
worldWorldbody1RigidBodybody2RigidBodycenterJVectorThe shared anchor point in world space.
rotateAxis1JVectorThe rotation axis attached to body 1, in world space.
rotateAxis2JVectorThe rotation axis attached to body 2, in world space.
driveJointDriveThe optional drive. Motor and servo torque default to zero.
Exceptions
- ArgumentOutOfRangeException
The drive selection is invalid.
- ArgumentException
Thrown when
centercontains a non-finite value, when either rotation axis is zero or contains a non-finite value, when either body does not belong toworld, or when both body references are the same.
UniversalJoint(World, RigidBody, RigidBody, JVector, JVector, JVector, bool)
Initializes a new universal joint.
[Obsolete("Use the overload accepting JointDrive instead of hasMotor.")]
public UniversalJoint(World world, RigidBody body1, RigidBody body2, JVector center, JVector rotateAxis1, JVector rotateAxis2, bool hasMotor)
Parameters
worldWorldbody1RigidBodybody2RigidBodycenterJVectorThe shared anchor point in world space.
rotateAxis1JVectorThe rotation axis attached to body 1, in world space.
rotateAxis2JVectorThe rotation axis attached to body 2, in world space.
hasMotorbool
Exceptions
- ArgumentOutOfRangeException
The drive selection is invalid.
- ArgumentException
Thrown when
centercontains a non-finite value, when either rotation axis is zero or contains a non-finite value, when either body does not belong toworld, or when both body references are the same.
Properties
BallSocket
public BallSocket BallSocket { get; }
Property Value
Body1
public RigidBody Body1 { get; }
Property Value
Body2
public RigidBody Body2 { get; }
Property Value
Motor
public AngularMotor? Motor { get; }
Property Value
Servo
public AngularServo? Servo { get; }
Property Value
TwistAngle
public TwistAngle TwistAngle { get; }