RelativeJoint2D
Keeps two Rigidbody2D at their relative orientations.
Read time 7 minutesLast updated 2 days ago
Definition
- Type: Class
- Namespace: UnityEngine
- Assembly: UnityEngine.Physics2DModule
- Inherits from: Joint2D
public sealed class RelativeJoint2D : Joint2D
Remarks
Two Rigidbody2D connected together with this joint will have forces applied to them to keep them both at their relative linear and angular offsets. If the joint is not connected to another Rigidbody2D then the body with the joint will stay at its current linear and angular offset in world-space i.e. it will be anchored to the implicit static ground-body.
You control the maximum linear force applied to maintain the RelativeJoint2D.linearOffset by using RelativeJoint2D.maxForce.
You control the maximum torque applied to maintain the RelativeJoint2D.angularOffset by using RelativeJoint2D.maxTorque
Additional Resources: RelativeJoint2D.linearOffset, RelativeJoint2D.angularOffset, RelativeJoint2D.maxForce, RelativeJoint2D.maxTorque.
Properties
Property | Description |
|---|---|
| angularOffset | The current angular offset between the Rigidbody2D that the joint connects. |
| autoConfigureOffset | Should both the linearOffset and angularOffset be calculated automatically? |
| correctionScale | Scales both the linear and angular forces used to correct the required relative orientation. |
| linearOffset | The current linear offset between the Rigidbody2D that the joint connects. |
| maxForce | The maximum force that can be generated when trying to maintain the relative joint constraint. |
| maxTorque | The maximum torque that can be generated when trying to maintain the relative joint constraint. |
| target | The world-space position that is currently trying to be maintained. |
Inheritance
Operators
Operator | Description |
|---|---|
| operator == | Compares two object references to see if they refer to the same object. |
| bool | Determines whether the object exists. |
| operator != | Compares if two objects refer to a different object. |