Documentation

Unity Engine


User Manual

Script Reference

Unity Engine


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

Properties

Property

Description

angularOffsetThe current angular offset between the Rigidbody2D that the joint connects.
autoConfigureOffsetShould both the linearOffset and angularOffset be calculated automatically?
correctionScaleScales both the linear and angular forces used to correct the required relative orientation.
linearOffsetThe current linear offset between the Rigidbody2D that the joint connects.
maxForceThe maximum force that can be generated when trying to maintain the relative joint constraint.
maxTorqueThe maximum torque that can be generated when trying to maintain the relative joint constraint.
targetThe world-space position that is currently trying to be maintained.

Inheritance

Inherited Members

Operators

Operator

Description

operator ==Compares two object references to see if they refer to the same object.
boolDetermines whether the object exists.
operator !=Compares if two objects refer to a different object.