# PhysicsRelativeJoint

> A joint constraint used to control the relative movement two bodies while still being responsive to collisions. A spring controls the position and rotation and velocity control allows for simulated friction such as seen in top-down games. A typical usage is to control the movement of a dynamic body with respect to the ground.

## Definition

* **Type:** Struct
* **Namespace:** [UnityEngine.LowLevelPhysics2D](/engine/6000.3/script-reference/unityengine/lowlevelphysics2d.md)
* **Assembly:** UnityEngine.Physics2DModule
* **Implements:** [IEquatable\<PhysicsRelativeJoint>](https://learn.microsoft.com/dotnet/api/system.iequatable-1)

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

## Constructors

| Constructor                                                                                                                                                    | Description                                                                                                                                                                                                                                                                                                                                     |
| -------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| [PhysicsRelativeJoint(UnityEngine.LowLevelPhysics2D.PhysicsJoint)](/engine/6000.3/script-reference/unityengine/lowlevelphysics2d/physicsrelativejoint/ctor.md) | Create a [PhysicsRelativeJoint](/engine/6000.3/script-reference/unityengine/lowlevelphysics2d/physicsrelativejoint.md) from the specified base joint. The provided joint must be a joint type of [PhysicsJoint.JointType.RelativeJoint](/engine/6000.3/script-reference/unityengine/lowlevelphysics2d/physicsjoint/jointtype/relativejoint.md). |

## Properties

| Property                                                                                                                                             | Description                                                                                                                                                                                                                                                                                                                                                                                              |
| ---------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| [angularVelocity](/engine/6000.3/script-reference/unityengine/lowlevelphysics2d/physicsrelativejoint/angularvelocity.md)                             | The desired angular velocity.                                                                                                                                                                                                                                                                                                                                                                            |
| [bodyA](/engine/6000.3/script-reference/unityengine/lowlevelphysics2d/physicsrelativejoint/bodya.md)                                                 | The first body the joint constrains.                                                                                                                                                                                                                                                                                                                                                                     |
| [bodyB](/engine/6000.3/script-reference/unityengine/lowlevelphysics2d/physicsrelativejoint/bodyb.md)                                                 | The second body the joint constrains.                                                                                                                                                                                                                                                                                                                                                                    |
| [callbackTarget](/engine/6000.3/script-reference/unityengine/lowlevelphysics2d/physicsrelativejoint/callbacktarget.md)                               | Get/Set the Object that event callbacks for this joint will be sent to. Care should be taken with any Object assigned as a callback target that isn't a [Object](/engine/6000.3/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. |
| [collideConnected](/engine/6000.3/script-reference/unityengine/lowlevelphysics2d/physicsrelativejoint/collideconnected.md)                           | Whether the shapes on the pair of bodies can come into contact.                                                                                                                                                                                                                                                                                                                                          |
| [currentAngularSeparationError](/engine/6000.3/script-reference/unityengine/lowlevelphysics2d/physicsrelativejoint/currentangularseparationerror.md) | Get the current angular separation error for this joint, in degrees. This does not consider admissible movement.                                                                                                                                                                                                                                                                                         |
| [currentConstraintForce](/engine/6000.3/script-reference/unityengine/lowlevelphysics2d/physicsrelativejoint/currentconstraintforce.md)               | Get the current constraint force used by the joint, usually in newtons.                                                                                                                                                                                                                                                                                                                                  |
| [currentConstraintTorque](/engine/6000.3/script-reference/unityengine/lowlevelphysics2d/physicsrelativejoint/currentconstrainttorque.md)             | Get the current constraint torque used by the joint, usually in newton-meters.                                                                                                                                                                                                                                                                                                                           |
| [currentLinearSeparationError](/engine/6000.3/script-reference/unityengine/lowlevelphysics2d/physicsrelativejoint/currentlinearseparationerror.md)   | Get the current linear separation error for this joint, usually in meters. This does not consider admissible movement.                                                                                                                                                                                                                                                                                   |
| [drawScale](/engine/6000.3/script-reference/unityengine/lowlevelphysics2d/physicsrelativejoint/drawscale.md)                                         | Controls the scaling of the joint drawing.                                                                                                                                                                                                                                                                                                                                                               |
| [forceThreshold](/engine/6000.3/script-reference/unityengine/lowlevelphysics2d/physicsrelativejoint/forcethreshold.md)                               | The force threshold beyond which a joint event will be produced.                                                                                                                                                                                                                                                                                                                                         |
| [isOwned](/engine/6000.3/script-reference/unityengine/lowlevelphysics2d/physicsrelativejoint/isowned.md)                                             | Get if the joint is owned. See [PhysicsJoint.SetOwner](/engine/6000.3/script-reference/unityengine/lowlevelphysics2d/physicsjoint/setowner.md).                                                                                                                                                                                                                                                          |
| [isValid](/engine/6000.3/script-reference/unityengine/lowlevelphysics2d/physicsrelativejoint/isvalid.md)                                             | Checks if the joint is valid.                                                                                                                                                                                                                                                                                                                                                                            |
| [jointType](/engine/6000.3/script-reference/unityengine/lowlevelphysics2d/physicsrelativejoint/jointtype.md)                                         | Gets the joint type. See [PhysicsJoint.JointType](/engine/6000.3/script-reference/unityengine/lowlevelphysics2d/physicsjoint/jointtype.md).                                                                                                                                                                                                                                                              |
| [linearVelocity](/engine/6000.3/script-reference/unityengine/lowlevelphysics2d/physicsrelativejoint/linearvelocity.md)                               | The desired linear velocity.                                                                                                                                                                                                                                                                                                                                                                             |
| [localAnchorA](/engine/6000.3/script-reference/unityengine/lowlevelphysics2d/physicsrelativejoint/localanchora.md)                                   | The local anchor frame constraint relative to bodyA's origin.                                                                                                                                                                                                                                                                                                                                            |
| [localAnchorB](/engine/6000.3/script-reference/unityengine/lowlevelphysics2d/physicsrelativejoint/localanchorb.md)                                   | The local anchor frame constraint relative to bodyB's origin.                                                                                                                                                                                                                                                                                                                                            |
| [maxForce](/engine/6000.3/script-reference/unityengine/lowlevelphysics2d/physicsrelativejoint/maxforce.md)                                           | The maximum linear force, usually in newtons. A value of zero is a special case which turns the limit off.                                                                                                                                                                                                                                                                                               |
| [maxTorque](/engine/6000.3/script-reference/unityengine/lowlevelphysics2d/physicsrelativejoint/maxtorque.md)                                         | The maximum torque, usually in newton-meters. A value of zero is a special case which turns the limit off.                                                                                                                                                                                                                                                                                               |
| [ownerUserData](/engine/6000.3/script-reference/unityengine/lowlevelphysics2d/physicsrelativejoint/owneruserdata.md)                                 | Get [PhysicsUserData](/engine/6000.3/script-reference/unityengine/lowlevelphysics2d/physicsuserdata.md) that can be used for any purpose, typically by the owner only.                                                                                                                                                                                                                                   |
| [springAngularDamping](/engine/6000.3/script-reference/unityengine/lowlevelphysics2d/physicsrelativejoint/springangulardamping.md)                   | The spring angular damping.                                                                                                                                                                                                                                                                                                                                                                              |
| [springAngularFrequency](/engine/6000.3/script-reference/unityengine/lowlevelphysics2d/physicsrelativejoint/springangularfrequency.md)               | The spring angular frequency, in cycles per second. A value of zero is a special case which turns the angular spring off.                                                                                                                                                                                                                                                                                |
| [springLinearDamping](/engine/6000.3/script-reference/unityengine/lowlevelphysics2d/physicsrelativejoint/springlineardamping.md)                     | The spring linear damping.                                                                                                                                                                                                                                                                                                                                                                               |
| [springLinearFrequency](/engine/6000.3/script-reference/unityengine/lowlevelphysics2d/physicsrelativejoint/springlinearfrequency.md)                 | The spring linear frequency, in cycles per second. A value of zero is a special case which turns the linear spring off.                                                                                                                                                                                                                                                                                  |
| [springMaxForce](/engine/6000.3/script-reference/unityengine/lowlevelphysics2d/physicsrelativejoint/springmaxforce.md)                               | The spring maximum linear force, usually in newtons. A value of zero is a special case which turns the force limit off.                                                                                                                                                                                                                                                                                  |
| [springMaxTorque](/engine/6000.3/script-reference/unityengine/lowlevelphysics2d/physicsrelativejoint/springmaxtorque.md)                             | The spring maximum torque, usually in newton-meters. A value of zero is a special case which turns the torque limit off.                                                                                                                                                                                                                                                                                 |
| [torqueThreshold](/engine/6000.3/script-reference/unityengine/lowlevelphysics2d/physicsrelativejoint/torquethreshold.md)                             | The torque threshold beyond which a joint event will be produced.                                                                                                                                                                                                                                                                                                                                        |
| [tuningDamping](/engine/6000.3/script-reference/unityengine/lowlevelphysics2d/physicsrelativejoint/tuningdamping.md)                                 | Controls the joint stiffness damping, non-dimensional. Use 1 for critical damping.                                                                                                                                                                                                                                                                                                                       |
| [tuningFrequency](/engine/6000.3/script-reference/unityengine/lowlevelphysics2d/physicsrelativejoint/tuningfrequency.md)                             | Controls the joint stiffness frequency, in cycles per second.                                                                                                                                                                                                                                                                                                                                            |
| [userData](/engine/6000.3/script-reference/unityengine/lowlevelphysics2d/physicsrelativejoint/userdata.md)                                           | Get/Set [PhysicsUserData](/engine/6000.3/script-reference/unityengine/lowlevelphysics2d/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.3/script-reference/unityengine/lowlevelphysics2d/physicsrelativejoint/world.md)                                                 | Get the world the body is attached to.                                                                                                                                                                                                                                                                                                                                                                   |

## Methods

| Method                                                                                                                     | Description                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 |
| -------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| [Destroy](/engine/6000.3/script-reference/unityengine/lowlevelphysics2d/physicsrelativejoint/destroy.md)                   | Destroy the joint. If the object is owned with [PhysicsJoint.SetOwner](/engine/6000.3/script-reference/unityengine/lowlevelphysics2d/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.3/script-reference/unityengine/lowlevelphysics2d/physicsrelativejoint/draw.md)                         | Draw a PhysicsJoint that visually represents its current state in the world. This is only used in the Unity Editor or in a Development Player.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              |
| [GetOwner](/engine/6000.3/script-reference/unityengine/lowlevelphysics2d/physicsrelativejoint/getowner.md)                 | Get the owner object associated with this joint as specified using [PhysicsJoint.SetOwner](/engine/6000.3/script-reference/unityengine/lowlevelphysics2d/physicsjoint/setowner.md).                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         |
| [SetOwner](/engine/6000.3/script-reference/unityengine/lowlevelphysics2d/physicsrelativejoint/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/6000.3/script-reference/unityengine/lowlevelphysics2d/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/6000.3/script-reference/unityengine/lowlevelphysics2d/physicsrelativejoint/setowneruserdata.md) | Set [PhysicsUserData](/engine/6000.3/script-reference/unityengine/lowlevelphysics2d/physicsuserdata.md) that can be used for any purpose, typically by the owner only.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      |
| [WakeBodies](/engine/6000.3/script-reference/unityengine/lowlevelphysics2d/physicsrelativejoint/wakebodies.md)             | Wake the pair of bodies the joint is constraining.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          |

## Static Methods

| Method                                                                                                             | Description                                                                                                                                                                                                                                         |
| ------------------------------------------------------------------------------------------------------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| [Create](/engine/6000.3/script-reference/unityengine/lowlevelphysics2d/physicsrelativejoint/create.md)             | Create a PhysicsRelativeJoint in the specified world.                                                                                                                                                                                               |
| [DestroyBatch](/engine/6000.3/script-reference/unityengine/lowlevelphysics2d/physicsrelativejoint/destroybatch.md) | Destroy a batch of joints. Owned joints will produce a warning and will not be destroyed (see [PhysicsJoint.SetOwner](/engine/6000.3/script-reference/unityengine/lowlevelphysics2d/physicsjoint/setowner.md)). Any invalid joints will be ignored. |

## Operators

| Operator                                                                                                                  | Description                                                                                                                                                                                                                                                                                                                                                                                                                    |
| ------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| [PhysicsRelativeJoint](/engine/6000.3/script-reference/unityengine/lowlevelphysics2d/physicsrelativejoint/op-implicit.md) | Cast to a [PhysicsRelativeJoint](/engine/6000.3/script-reference/unityengine/lowlevelphysics2d/physicsrelativejoint.md) from the base [PhysicsJoint](/engine/6000.3/script-reference/unityengine/lowlevelphysics2d/physicsjoint.md). The provided joint must be a joint type of [PhysicsJoint.JointType.RelativeJoint](/engine/6000.3/script-reference/unityengine/lowlevelphysics2d/physicsjoint/jointtype/relativejoint.md). |
| [PhysicsJoint](/engine/6000.3/script-reference/unityengine/lowlevelphysics2d/physicsrelativejoint/op-implicit.md)         | Cast to the base [PhysicsJoint](/engine/6000.3/script-reference/unityengine/lowlevelphysics2d/physicsjoint.md).                                                                                                                                                                                                                                                                                                                |
