Target Constraint

Introduction

TargetConstraint is a class that adds a new layer of abstraction over the component ConfigurableJoint.

Variables

  • Enabled: This option can be enabled/disabled in runtime. Pheasy will create or destroy the ConfigurableJoint when needed.

  • Name: Descriptive name of the constraint that can be used for debugging. It doesn't affect the behaviour of the object.

  • Joint: Reference to the ConfigurableJoint related to this constraint. If null and the constraint is enabled, Pheasy will create the ConfigurableJoint and it will set this refernce automatically.

Connections

  • Anchor: Part of the Rigidbody, represented by a Transform, that will eventually match world position and world rotation of TargetConstraint.connectedAnchor. If null, a new Transform will be created as child of Rigidbody and it will be referenced here automatically.

  • Connected Anchor: Transform that represents the goal which world position and world rotation will eventually be matched by constraint's anchor. If null, a new Transform will be created as child of Rigidbody's parent or child of TargetConstraint.connectedBody (if it's not null). When this Transform is created automatically, its position and rotation will match position and rotation of the constrained Rigidbody.

  • Connected Body: Reference that will be applied to TargetConstraint.joint.connectedBody every time the joint is created.

Control

  • Keep Axis Relative To Object: Value that will be applied inverted to TagetConstraint.joint.configuredInWorldSpace.

  • Axis: Transform that will represent the joint's axis. If null, a new Transform will be created as sibling of TargetConstraint.connectedAnchor but its rotation will match joint axis.

  • Target Position: Transform which position will be used to calculate TargetConstraint.joint.targetPosition.

Settings

  • Linear Motion: Level of linear freedom that joint axes will have.

  • Angular Motion: Level of angular freedom that joint axes will have.

  • Angular Drive: Drive values that will be applied to Angular X Drive, Angular YX Drive and Slerp Drive in TargetConstraint.joint.

  • Motion Drive: Drive values that will be applied to X Drive, Y Drive and Z Drive in TargetConstraint.joint.

  • Collide With Connected: Value that will be applied to TargetConstraint.joint.enableCollision.

Stability

  • Error: Distance between anchor and connected anchor.

  • Gradual Max Time: If Pheasy.gradualMode is enabled, this is the time it will take maximum forces in joint drives to reach their final value when the joint is created.

Extensibility

  • Extensions: List of TargetExtensions that will be executed by Pheasy component.

Debug

  • Force: If enabled, Rigidbody's position and rotation will be changed to make TargetConstraint.anchor to match TargetConstraint.connectedAnchor every frame.

  • Show Axis: Pheasy.axis will be shown at joint center but matching joint axis rotation.

  • Show Anchor: Pheasy.axis will be shown at TargetConstraint.anchor, matching its position and rotation.

  • Show Conn Anchor: Pheasy.axis will be shown at TargetConstraint.connectedAnchor, matching its position and rotation.

Last updated