HingeJoint
The HingeJoint groups together 2 rigid bodies, constraining them to move like connected by a hinge.
Read time 7 minutesLast updated 2 days ago
Definition
- Type: Class
- Namespace: UnityEngine
- Assembly: UnityEngine.PhysicsModule
- Inherits from: Joint
[RequireComponent(typeof(Rigidbody))]public class HingeJoint : Joint
Remarks
This joint is great for, well, doors, but can also be used to model chains, etc...
The HingeJoint has a motor which can be used to make the hinge spin around the joints axis. A spring which attempts to reach for a target angle by spinning around the joints axis. And a limit which constrains the joint angle.
Properties
Property | Description |
|---|---|
| angle | The current angle in degrees of the joint relative to its rest position. (Read Only) |
| extendedLimits | If enabled, the angle of the hinge is extended to [-360, 360] degrees. |
| limits | Limit of angular rotation (in degrees) on the hinge joint. |
| motor | The motor will apply a force up to a maximum force to achieve the target velocity in degrees per second. |
| spring | The spring attempts to reach a target angle by adding spring and damping forces. |
| useAcceleration | Defines whether the HingeJoint.spring outputs accelerations instead of forces. |
| useLimits | Enables the joint's HingeJoint.limits. Disabled by default. |
| useMotor | Enables the joint's HingeJoint.motor. Disabled by default. |
| useSpring | Enables the joint's HingeJoint.spring. Disabled by default. |
| velocity | The angular velocity of the joint in degrees per second. (Read Only) |
Inheritance
Operators
Operator | Description |
|---|---|
| operator == | Compares two object references to see if they refer to the same object. |
| bool | Determines whether the object exists. |
| operator != | Compares if two objects refer to a different object. |