# PhysicsHingeJoint

> A joint where an anchor point on body B is fixed to an anchor point on body A. This joint allows relative rotation.

## Definition

* **Type:** Struct
* **Namespace:** [Unity.U2D.Physics](/engine/7000.0/script-reference/unity/u2d/physics.md)
* **Assembly:** UnityEngine.PhysicsCore2DModule
* **Implements:** [IEquatable\<PhysicsHingeJoint>](https://learn.microsoft.com/dotnet/api/system.iequatable-1)

```csharp
public readonly struct PhysicsHingeJoint : IEquatable<PhysicsHingeJoint>
```

## Constructors

| Constructor                                                                                                                                                          | Description                                                                                                                                                                                                                                                                                                 |
| -------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| [PhysicsHingeJoint(Unity.U2D.Physics.PhysicsHandle)](/engine/7000.0/script-reference/unity/u2d/physics/physicshingejoint/ctor.md#physicshingejoint\(physicshandle\)) | Create a joint from a physics handle.                                                                                                                                                                                                                                                                       |
| [PhysicsHingeJoint(Unity.U2D.Physics.PhysicsJoint)](/engine/7000.0/script-reference/unity/u2d/physics/physicshingejoint/ctor.md#physicshingejoint\(physicsjoint\))   | Create a [PhysicsHingeJoint](/engine/7000.0/script-reference/unity/u2d/physics/physicshingejoint.md) from the specified base joint. The provided joint must be a joint type of [PhysicsJoint.JointType.HingeJoint](/engine/7000.0/script-reference/unity/u2d/physics/physicsjoint/jointtype/hingejoint.md). |

## Properties

| Property                                                                                                                              | Description                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     |
| ------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| [angle](/engine/7000.0/script-reference/unity/u2d/physics/physicshingejoint/angle.md)                                                 | Get the current angle of the joint, in degrees.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 |
| [bodyA](/engine/7000.0/script-reference/unity/u2d/physics/physicshingejoint/bodya.md)                                                 | The first body the joint constrains.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            |
| [bodyB](/engine/7000.0/script-reference/unity/u2d/physics/physicshingejoint/bodyb.md)                                                 | The second body the joint constrains.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           |
| [callbackTarget](/engine/7000.0/script-reference/unity/u2d/physics/physicshingejoint/callbacktarget.md)                               | Get/Set the [Object](/engine/7000.0/script-reference/unityengine/object.md) that event callbacks for this joint will be sent to. Care should be taken with any [Object](/engine/7000.0/script-reference/unityengine/object.md) assigned as a callback target that isn't a [Object](/engine/7000.0/script-reference/unityengine/object.md) as this assignment will not in itself keep the object alive and can be garbage collected. To avoid this, you should have at least a single reference to the object in your code. To remove the object assigned here, set the callback target to NULL. |
| [collideConnected](/engine/7000.0/script-reference/unity/u2d/physics/physicshingejoint/collideconnected.md)                           | Whether the shapes on the pair of bodies can come into contact.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 |
| [currentAngularSeparationError](/engine/7000.0/script-reference/unity/u2d/physics/physicshingejoint/currentangularseparationerror.md) | Get the current angular separation error for this joint, in degrees. This does not consider admissible movement.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                |
| [currentConstraintForce](/engine/7000.0/script-reference/unity/u2d/physics/physicshingejoint/currentconstraintforce.md)               | Get the current constraint force used by the joint, usually in newtons.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         |
| [currentConstraintTorque](/engine/7000.0/script-reference/unity/u2d/physics/physicshingejoint/currentconstrainttorque.md)             | Get the current constraint torque used by the joint, usually in newton-meters.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  |
| [currentLinearSeparationError](/engine/7000.0/script-reference/unity/u2d/physics/physicshingejoint/currentlinearseparationerror.md)   | Get the current linear separation error for this joint, usually in meters. This does not consider admissible movement.                                                                                                                                                                                                                                                                                                                                                                                                                                                                          |
| [currentMotorTorque](/engine/7000.0/script-reference/unity/u2d/physics/physicshingejoint/currentmotortorque.md)                       | Get the current motor torque.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   |
| [currentSpringTorque](/engine/7000.0/script-reference/unity/u2d/physics/physicshingejoint/currentspringtorque.md)                     | The torque the spring applied around the hinge during the last simulation step, usually in newton-meters. A positive value turns body B counter-clockwise relative to body A and a negative value turns it clockwise. This is zero when the spring is disabled. Unlike the current constraint torque, it excludes the torque from the angle limits and the motor.                                                                                                                                                                                                                               |
| [definition](/engine/7000.0/script-reference/unity/u2d/physics/physicshingejoint/definition.md)                                       | Get or set the joint definition. Reading returns the joint's current configuration, including [PhysicsHingeJoint.bodyA](/engine/7000.0/script-reference/unity/u2d/physics/physicshingejoint/bodya.md) and [PhysicsHingeJoint.bodyB](/engine/7000.0/script-reference/unity/u2d/physics/physicshingejoint/bodyb.md). Writing applies every configurable property in place but does not change the connected bodies, which are fixed when the joint is created.                                                                                                                                    |
| [drawScale](/engine/7000.0/script-reference/unity/u2d/physics/physicshingejoint/drawscale.md)                                         | Controls the scaling of the joint drawing.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      |
| [drawTarget](/engine/7000.0/script-reference/unity/u2d/physics/physicshingejoint/drawtarget.md)                                       | Controls which Unity editor views this joint is drawn into.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     |
| [enableLimit](/engine/7000.0/script-reference/unity/u2d/physics/physicshingejoint/enablelimit.md)                                     | Enable/Disable the joint rotation limit.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        |
| [enableMotor](/engine/7000.0/script-reference/unity/u2d/physics/physicshingejoint/enablemotor.md)                                     | Enable/Disable the joint motor.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 |
| [enableSpring](/engine/7000.0/script-reference/unity/u2d/physics/physicshingejoint/enablespring.md)                                   | Enable/Disable the rotational spring.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           |
| [enableUnpinned](/engine/7000.0/script-reference/unity/u2d/physics/physicshingejoint/enableunpinned.md)                               | Enable/Disable unpinned mode where only Body A is affected and body B and its local anchor point is ignored. Body B must still be assigned so it is typical to assign a static ground body, preferably shared/reused.                                                                                                                                                                                                                                                                                                                                                                           |
| [forceThreshold](/engine/7000.0/script-reference/unity/u2d/physics/physicshingejoint/forcethreshold.md)                               | The force threshold beyond which a joint event will be produced.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                |
| [isOwned](/engine/7000.0/script-reference/unity/u2d/physics/physicshingejoint/isowned.md)                                             | Get if the joint is owned. See [PhysicsJoint.SetOwner](/engine/7000.0/script-reference/unity/u2d/physics/physicsjoint/setowner.md).                                                                                                                                                                                                                                                                                                                                                                                                                                                             |
| [isValid](/engine/7000.0/script-reference/unity/u2d/physics/physicshingejoint/isvalid.md)                                             | Checks if the joint is valid.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   |
| [jointType](/engine/7000.0/script-reference/unity/u2d/physics/physicshingejoint/jointtype.md)                                         | Gets the joint type. See [PhysicsJoint.JointType](/engine/7000.0/script-reference/unity/u2d/physics/physicsjoint/jointtype.md).                                                                                                                                                                                                                                                                                                                                                                                                                                                                 |
| [localAnchorA](/engine/7000.0/script-reference/unity/u2d/physics/physicshingejoint/localanchora.md)                                   | The local anchor frame constraint relative to bodyA's origin.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   |
| [localAnchorB](/engine/7000.0/script-reference/unity/u2d/physics/physicshingejoint/localanchorb.md)                                   | The local anchor frame constraint relative to bodyB's origin.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   |
| [lowerAngleLimit](/engine/7000.0/script-reference/unity/u2d/physics/physicshingejoint/loweranglelimit.md)                             | Get the lower angle limit, in degrees.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          |
| [maxMotorTorque](/engine/7000.0/script-reference/unity/u2d/physics/physicshingejoint/maxmotortorque.md)                               | The maximum torque the motor can apply, usually in newton-meters.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               |
| [motorSpeed](/engine/7000.0/script-reference/unity/u2d/physics/physicshingejoint/motorspeed.md)                                       | The desired motor speed, usually in degrees per second.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         |
| [owner](/engine/7000.0/script-reference/unity/u2d/physics/physicshingejoint/owner.md)                                                 | The owner object associated with this joint, or NULL if no owner has been specified. This is a convenience property that returns the same value as [PhysicsHingeJoint.GetOwner](/engine/7000.0/script-reference/unity/u2d/physics/physicshingejoint/getowner.md).                                                                                                                                                                                                                                                                                                                               |
| [ownerUserData](/engine/7000.0/script-reference/unity/u2d/physics/physicshingejoint/owneruserdata.md)                                 | Get [PhysicsUserData](/engine/7000.0/script-reference/unity/u2d/physics/physicsuserdata.md) that can be used for any purpose, typically by the owner only.                                                                                                                                                                                                                                                                                                                                                                                                                                      |
| [physicsHandle](/engine/7000.0/script-reference/unity/u2d/physics/physicshingejoint/physicshandle.md)                                 | Get the physics handle.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         |
| [selectedDrawing](/engine/7000.0/script-reference/unity/u2d/physics/physicshingejoint/selecteddrawing.md)                             | Controls whether this joint is drawn individually when the world is drawn.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      |
| [springDamping](/engine/7000.0/script-reference/unity/u2d/physics/physicshingejoint/springdamping.md)                                 | The spring damping, non-dimensional.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            |
| [springFrequency](/engine/7000.0/script-reference/unity/u2d/physics/physicshingejoint/springfrequency.md)                             | The spring stiffness, in cycles per second.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     |
| [springTargetAngle](/engine/7000.0/script-reference/unity/u2d/physics/physicshingejoint/springtargetangle.md)                         | The spring target angle, in degrees.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            |
| [torqueThreshold](/engine/7000.0/script-reference/unity/u2d/physics/physicshingejoint/torquethreshold.md)                             | The torque threshold beyond which a joint event will be produced.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               |
| [tuningDamping](/engine/7000.0/script-reference/unity/u2d/physics/physicshingejoint/tuningdamping.md)                                 | Controls the joint stiffness damping, non-dimensional. Use 1 for critical damping.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              |
| [tuningFrequency](/engine/7000.0/script-reference/unity/u2d/physics/physicshingejoint/tuningfrequency.md)                             | Controls the joint stiffness frequency, in cycles per second.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   |
| [upperAngleLimit](/engine/7000.0/script-reference/unity/u2d/physics/physicshingejoint/upperanglelimit.md)                             | Get the upper angle limit, in degrees.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          |
| [userData](/engine/7000.0/script-reference/unity/u2d/physics/physicshingejoint/userdata.md)                                           | Get/Set [PhysicsUserData](/engine/7000.0/script-reference/unity/u2d/physics/physicsuserdata.md) that can be used for any purpose. The physics system doesn't use this data, it is entirely for custom use.                                                                                                                                                                                                                                                                                                                                                                                      |
| [world](/engine/7000.0/script-reference/unity/u2d/physics/physicshingejoint/world.md)                                                 | Get the world the body is attached to.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          |
| [worldDrawing](/engine/7000.0/script-reference/unity/u2d/physics/physicshingejoint/worlddrawing.md)                                   | Controls whether this joint is automatically drawn when the world is drawn.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     |

## Methods

| Method                                                                                                      | Description                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     |
| ----------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| [Destroy](/engine/7000.0/script-reference/unity/u2d/physics/physicshingejoint/destroy.md)                   | Destroy the joint. If the object is owned with [PhysicsJoint.SetOwner](/engine/7000.0/script-reference/unity/u2d/physics/physicsjoint/setowner.md) then you must provide the owner key it returned. Failing to do so will return a warning and the joint will not be destroyed.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 |
| [Draw](/engine/7000.0/script-reference/unity/u2d/physics/physicshingejoint/draw.md)                         | Draw this joint's current state once, as custom drawing.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        |
| [GetOwner](/engine/7000.0/script-reference/unity/u2d/physics/physicshingejoint/getowner.md)                 | Get the owner object associated with this joint as specified using [PhysicsJoint.SetOwner](/engine/7000.0/script-reference/unity/u2d/physics/physicsjoint/setowner.md).                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         |
| [SetOwner](/engine/7000.0/script-reference/unity/u2d/physics/physicshingejoint/setowner.md)                 | Set the (optional) owner object associated with this joint and return an owner key that must be specified when destroying the joint with [PhysicsJoint.Destroy](/engine/7000.0/script-reference/unity/u2d/physics/physicsjoint/destroy.md). The physics system provides access to all objects, including the ability to destroy them so this feature can be used to stop accidental destruction of objects that are owned by other objects. You can only set the owner once, multiple attempts will produce a warning. The lifetime of the specified owner object is not linked to this joint i.e. this joint will still be owned by the owner object, even if it is destroyed. It is also valid to not specify an owner object (NULL) to simply gain an owner key however it can be useful, if simply for debugging purposes and discovery, to know which object is the owner. |
| [SetOwnerUserData](/engine/7000.0/script-reference/unity/u2d/physics/physicshingejoint/setowneruserdata.md) | Set [PhysicsUserData](/engine/7000.0/script-reference/unity/u2d/physics/physicsuserdata.md) that can be used for any purpose, typically by the owner only.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      |
| [WakeBodies](/engine/7000.0/script-reference/unity/u2d/physics/physicshingejoint/wakebodies.md)             | Wake the pair of bodies the joint is constraining.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              |

## Static Methods

| Method                                                                                              | Description                                                                                                                                                                                                                             |
| --------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| [Create](/engine/7000.0/script-reference/unity/u2d/physics/physicshingejoint/create.md)             | Create a PhysicsHingeJoint in the specified world.                                                                                                                                                                                      |
| [DestroyBatch](/engine/7000.0/script-reference/unity/u2d/physics/physicshingejoint/destroybatch.md) | Destroy a batch of joints. Owned joints will produce a warning and will not be destroyed (see [PhysicsJoint.SetOwner](/engine/7000.0/script-reference/unity/u2d/physics/physicsjoint/setowner.md)). Any invalid joints will be ignored. |

## Operators

| Operator                                                                                                | Description                                                                                                                                                                                                                                                                                                                                                                    |
| ------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| [PhysicsJoint](/engine/7000.0/script-reference/unity/u2d/physics/physicshingejoint/op-implicit.md)      | Cast to the base [PhysicsJoint](/engine/7000.0/script-reference/unity/u2d/physics/physicsjoint.md).                                                                                                                                                                                                                                                                            |
| [PhysicsHingeJoint](/engine/7000.0/script-reference/unity/u2d/physics/physicshingejoint/op-implicit.md) | Cast to a [PhysicsHingeJoint](/engine/7000.0/script-reference/unity/u2d/physics/physicshingejoint.md) from the base [PhysicsJoint](/engine/7000.0/script-reference/unity/u2d/physics/physicsjoint.md). The provided joint must be a joint type of [PhysicsJoint.JointType.HingeJoint](/engine/7000.0/script-reference/unity/u2d/physics/physicsjoint/jointtype/hingejoint.md). |
