# PhysicsJoint

> A joint is used to constrain bodies to the world or to each other in various ways. A joint is automatically destroyed when either body it is attached to is destroyed. A joint cannot exist unattached from a body.

## Definition

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

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

## Constructors

| Constructor                                                                                                             | Description                           |
| ----------------------------------------------------------------------------------------------------------------------- | ------------------------------------- |
| [PhysicsJoint(Unity.U2D.Physics.PhysicsHandle)](/engine/6000.5/script-reference/unity/u2d/physics/physicsjoint/ctor.md) | Create a joint from a physics handle. |

## Properties

| Property                                                                                                                         | Description                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            |
| -------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| [bodyA](/engine/6000.5/script-reference/unity/u2d/physics/physicsjoint/bodya.md)                                                 | The first body the joint constrains.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   |
| [bodyB](/engine/6000.5/script-reference/unity/u2d/physics/physicsjoint/bodyb.md)                                                 | The second body the joint constrains.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  |
| [callbackTarget](/engine/6000.5/script-reference/unity/u2d/physics/physicsjoint/callbacktarget.md)                               | Get/Set the [Object](/engine/6000.5/script-reference/unityengine/object.md) object that event callbacks for this joint will be sent to. Care should be taken with any [Object](/engine/6000.5/script-reference/unityengine/object.md) assigned as a callback target that isn't a [Object](/engine/6000.5/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/6000.5/script-reference/unity/u2d/physics/physicsjoint/collideconnected.md)                           | Whether the shapes on the pair of bodies can come into contact.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        |
| [currentAngularSeparationError](/engine/6000.5/script-reference/unity/u2d/physics/physicsjoint/currentangularseparationerror.md) | Get the current angular separation error for this joint, in degrees. This does not consider admissible movement.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       |
| [currentConstraintForce](/engine/6000.5/script-reference/unity/u2d/physics/physicsjoint/currentconstraintforce.md)               | Get the current constraint force used by the joint, usually in newtons.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                |
| [currentConstraintTorque](/engine/6000.5/script-reference/unity/u2d/physics/physicsjoint/currentconstrainttorque.md)             | Get the current constraint torque used by the joint, usually in newton-meters.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         |
| [currentLinearSeparationError](/engine/6000.5/script-reference/unity/u2d/physics/physicsjoint/currentlinearseparationerror.md)   | Get the current linear separation error for this joint, usually in meters. This does not consider admissible movement.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 |
| [drawScale](/engine/6000.5/script-reference/unity/u2d/physics/physicsjoint/drawscale.md)                                         | Controls the scaling of the joint drawing. Not all joints have scalable elements but those that do will use this scaling.                                                                                                                                                                                                                                                                                                                                                                                                                                                                              |
| [forceThreshold](/engine/6000.5/script-reference/unity/u2d/physics/physicsjoint/forcethreshold.md)                               | The force threshold beyond which a joint event will be produced.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       |
| [isOwned](/engine/6000.5/script-reference/unity/u2d/physics/physicsjoint/isowned.md)                                             | Get if the joint is owned. See [PhysicsJoint.SetOwner](/engine/6000.5/script-reference/unity/u2d/physics/physicsjoint/setowner.md).                                                                                                                                                                                                                                                                                                                                                                                                                                                                    |
| [isValid](/engine/6000.5/script-reference/unity/u2d/physics/physicsjoint/isvalid.md)                                             | Checks if the joint is valid.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          |
| [jointType](/engine/6000.5/script-reference/unity/u2d/physics/physicsjoint/jointtype-1.md)                                       | Gets the joint type. See [PhysicsJoint.JointType](/engine/6000.5/script-reference/unity/u2d/physics/physicsjoint/jointtype.md).                                                                                                                                                                                                                                                                                                                                                                                                                                                                        |
| [localAnchorA](/engine/6000.5/script-reference/unity/u2d/physics/physicsjoint/localanchora.md)                                   | The local anchor frame constraint relative to bodyA's origin.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          |
| [localAnchorB](/engine/6000.5/script-reference/unity/u2d/physics/physicsjoint/localanchorb.md)                                   | The local anchor frame constraint relative to bodyB's origin.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          |
| [ownerUserData](/engine/6000.5/script-reference/unity/u2d/physics/physicsjoint/owneruserdata.md)                                 | Get [PhysicsUserData](/engine/6000.5/script-reference/unity/u2d/physics/physicsuserdata.md) that can be used for any purpose, typically by the owner only.                                                                                                                                                                                                                                                                                                                                                                                                                                             |
| [physicsHandle](/engine/6000.5/script-reference/unity/u2d/physics/physicsjoint/physicshandle.md)                                 | Get the physics handle.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                |
| [torqueThreshold](/engine/6000.5/script-reference/unity/u2d/physics/physicsjoint/torquethreshold.md)                             | The torque threshold beyond which a joint event will be produced.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      |
| [tuningDamping](/engine/6000.5/script-reference/unity/u2d/physics/physicsjoint/tuningdamping.md)                                 | Controls the joint stiffness damping, non-dimensional. Use 1 for critical damping.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     |
| [tuningFrequency](/engine/6000.5/script-reference/unity/u2d/physics/physicsjoint/tuningfrequency.md)                             | Controls the joint stiffness frequency, in cycles per second.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          |
| [userData](/engine/6000.5/script-reference/unity/u2d/physics/physicsjoint/userdata.md)                                           | Get/Set [PhysicsUserData](/engine/6000.5/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/6000.5/script-reference/unity/u2d/physics/physicsjoint/world.md)                                                 | Get the world the body is attached to.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 |
| [worldDrawing](/engine/6000.5/script-reference/unity/u2d/physics/physicsjoint/worlddrawing.md)                                   | Controls whether this joint is automatically drawn when the world is drawn.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            |

## Methods

| Method                                                                                                 | Description                                                                                                                                                                                                                                                                                                                                                                                                                  |
| ------------------------------------------------------------------------------------------------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| [Destroy](/engine/6000.5/script-reference/unity/u2d/physics/physicsjoint/destroy.md)                   | Destroy the joint. If the object is owned with [PhysicsJoint.SetOwner](/engine/6000.5/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/6000.5/script-reference/unity/u2d/physics/physicsjoint/draw.md)                         | Draw a PhysicsJoint that visually represents its current state in the world.                                                                                                                                                                                                                                                                                                                                                 |
| [GetOwner](/engine/6000.5/script-reference/unity/u2d/physics/physicsjoint/getowner.md)                 | Get the owner object associated with this joint as specified using [PhysicsJoint.SetOwner](/engine/6000.5/script-reference/unity/u2d/physics/physicsjoint/setowner.md).                                                                                                                                                                                                                                                      |
| [SetOwner](/engine/6000.5/script-reference/unity/u2d/physics/physicsjoint/setowner.md)                 | Set the owner object using the specified owner key. You can only set the owner once, multiple attempts will produce a warning. This call does not bind the lifetime of the specified owner object, it is simply a reference. 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/6000.5/script-reference/unity/u2d/physics/physicsjoint/setowneruserdata.md) | Set [PhysicsUserData](/engine/6000.5/script-reference/unity/u2d/physics/physicsuserdata.md) that can be used for any purpose, typically by the owner only.                                                                                                                                                                                                                                                                   |
| [WakeBodies](/engine/6000.5/script-reference/unity/u2d/physics/physicsjoint/wakebodies.md)             | Wake the pair of bodies the joint is constraining.                                                                                                                                                                                                                                                                                                                                                                           |

## Static Methods

| Method                                                                                         | Description                                                                                                                                                                                                                                                                                                                      |
| ---------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| [CreateJoint](/engine/6000.5/script-reference/unity/u2d/physics/physicsjoint/createjoint.md)   | Create a PhysicsDistanceJoint in the world. See [PhysicsDistanceJoint.Create](/engine/6000.5/script-reference/unity/u2d/physics/physicsdistancejoint/create.md).                                                                                                                                                                 |
| [DestroyBatch](/engine/6000.5/script-reference/unity/u2d/physics/physicsjoint/destroybatch.md) | Destroy a batch of joints. Owned joints will produce a warning and will not be destroyed (see [PhysicsJoint.SetOwner](/engine/6000.5/script-reference/unity/u2d/physics/physicsjoint/setowner.md)). Any invalid joints will be ignored.                                                                                          |
| [SetOwner](/engine/6000.5/script-reference/unity/u2d/physics/physicsjoint/setowner.md)         | Set the owner object using the specified owner key. You can only set the owner once, multiple attempts will produce a warning. This call does not bind the lifetime of the specified owner object, it is simply a reference. Whilst it is valid to not specify an owner object (NULL), it is recommended for debugging purposes. |

## Enums

| Enum                                                                                                  | Description        |
| ----------------------------------------------------------------------------------------------------- | ------------------ |
| [PhysicsJoint.JointType](/engine/6000.5/script-reference/unity/u2d/physics/physicsjoint/jointtype.md) | The type of joint. |
