Class HingeJoint
- Namespace
- Jitter2.Dynamics.Constraints
- Assembly
- Jitter2.dll
Connects two bodies at a shared anchor, allowing relative rotation around one axis. Supports angular limits and an optional motor or servo.
public class HingeJoint : Joint, IDebugDrawable
- Inheritance
-
HingeJoint
- Implements
- Inherited Members
Constructors
HingeJoint(World, RigidBody, RigidBody, JVector, JVector, AngularLimit, JointDrive)
Initializes a new hinge joint.
public HingeJoint(World world, RigidBody body1, RigidBody body2, JVector hingeCenter, JVector hingeAxis, AngularLimit angle, JointDrive drive = JointDrive.None)
Parameters
worldWorldbody1RigidBodybody2RigidBodyhingeCenterJVectorThe shared anchor point in world space.
hingeAxisJVectorThe rotation axis in world space.
angleAngularLimitAllowed rotation relative to the initial pose.
driveJointDriveThe optional drive. Motor and servo torque default to zero.
Exceptions
- ArgumentOutOfRangeException
The drive selection is invalid.
- ArgumentException
Thrown when
hingeCentercontains a non-finite value, whenhingeAxisis zero or contains a non-finite value, when either body does not belong toworld, or when both body references are the same.
HingeJoint(World, RigidBody, RigidBody, JVector, JVector, AngularLimit, bool)
Initializes a new hinge joint.
[Obsolete("Use the overload accepting JointDrive instead of hasMotor.")]
public HingeJoint(World world, RigidBody body1, RigidBody body2, JVector hingeCenter, JVector hingeAxis, AngularLimit angle, bool hasMotor)
Parameters
worldWorldbody1RigidBodybody2RigidBodyhingeCenterJVectorThe shared anchor point in world space.
hingeAxisJVectorThe rotation axis in world space.
angleAngularLimitAllowed rotation relative to the initial pose.
hasMotorbool
Exceptions
- ArgumentOutOfRangeException
The drive selection is invalid.
- ArgumentException
Thrown when
hingeCentercontains a non-finite value, whenhingeAxisis zero or contains a non-finite value, when either body does not belong toworld, or when both body references are the same.
HingeJoint(World, RigidBody, RigidBody, JVector, JVector, JointDrive)
Initializes a new hinge joint.
public HingeJoint(World world, RigidBody body1, RigidBody body2, JVector hingeCenter, JVector hingeAxis, JointDrive drive = JointDrive.None)
Parameters
worldWorldbody1RigidBodybody2RigidBodyhingeCenterJVectorThe shared anchor point in world space.
hingeAxisJVectorThe rotation axis in world space.
driveJointDriveThe optional drive. Motor and servo torque default to zero.
Exceptions
- ArgumentOutOfRangeException
The drive selection is invalid.
- ArgumentException
Thrown when
hingeCentercontains a non-finite value, whenhingeAxisis zero or contains a non-finite value, when either body does not belong toworld, or when both body references are the same.
HingeJoint(World, RigidBody, RigidBody, JVector, JVector, bool)
Initializes a new hinge joint.
[Obsolete("Use the overload accepting JointDrive instead of hasMotor.")]
public HingeJoint(World world, RigidBody body1, RigidBody body2, JVector hingeCenter, JVector hingeAxis, bool hasMotor)
Parameters
worldWorldbody1RigidBodybody2RigidBodyhingeCenterJVectorThe shared anchor point in world space.
hingeAxisJVectorThe rotation axis in world space.
hasMotorbool
Exceptions
- ArgumentOutOfRangeException
The drive selection is invalid.
- ArgumentException
Thrown when
hingeCentercontains a non-finite value, whenhingeAxisis 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
HingeAngle
public HingeAngle HingeAngle { get; }
Property Value
Motor
public AngularMotor? Motor { get; }
Property Value
Servo
public TwistServo? Servo { get; }