TargetJoint2D

class in UnityEngine

/

Inherits from:Joint2D

Switch to Manual

Description

The joint attempts to move a Rigidbody2D to a specific target position.

This joint is the only joint that doesn't connect two Rigidbody2D together. Instead, it only operates on the single body it is connected to.

When connected, it will attempt to move the body to a specified target position. When setting a target you can also set the anchor position which is a point relative to the Rigidbody2D where forces will be applied.

The joint moves the body using a configurable spring that has a force limit.

An example usage for this joint might be to enable Collider2D to be dragged, selecting an anchor point and moving the body to the position under the mouse.

Variables

anchorThe local-space anchor on the rigid-body the joint is attached to.
autoConfigureTargetShould the target be calculated automatically?
dampingRatioThe amount by which the target spring force is reduced in proportion to the movement speed.
frequencyThe frequency at which the target spring oscillates around the target position.
maxForceThe maximum force that can be generated when trying to maintain the target joint constraint.
targetThe world-space position that the joint will attempt to move the body to.

Inherited members

Variables

enabledВключенное Поведение обновляется, выключенное Поведение не обновляется.
isActiveAndEnabledHas the Behaviour had active and enabled called?
gameObjectИгровой объект к которому прикреплён данный компонент. Компонент всегда прикреплён к игровому объекту.
tagТег данного игрового объекта.
transformThe Transform attached to this GameObject.
attachedRigidbodyThe Rigidbody2D attached to the Joint2D.
breakForceСила, которую надо применить к соединению, чтобы сломать его.
breakTorqueКрутящий момент, необходимый для разрыва данного сустава.
connectedBodyОбъект Rigidbody2D, к которому подсоединен другой конец сустава (т.е. объект без компонента joint).
enableCollisionShould the two rigid bodies connected with this joint collide with each other?
reactionForceGets the reaction force of the joint.
reactionTorqueGets the reaction torque of the joint.
hideFlagsShould the object be hidden, saved with the Scene or modifiable by the user?
nameThe name of the object.

Public Functions

BroadcastMessageВызывает метод названный methodName на каждом MonoBehaviour этого game object-а или любого из его потомков.
CompareTagПомечен ли данный игровой объект тегом tag?
GetComponentВозвращает компонент типа type, если он прикреплен к игровому объекту и null, если не прикреплен.
GetComponentInChildrenВозвращает компонент типа type в GameObject или некоторого его потомка через поиск в глубину.
GetComponentInParentВозвращает все компоненты типа type из GameObject'а или из любого его родителя.
GetComponentsВозвращает все компоненты типа type в GameObject.
GetComponentsInChildrenВозвращает все компоненты типа type в GameObject или любому из его потомков.
GetComponentsInParentВозвращает все компоненты типа type в GameObject или любому из его родителей.
SendMessageВызывает метод с названием methodName в каждом MonoBehaviour в этом игровом объекте.
SendMessageUpwardsВызывает метод с именем methodName в каждом MonoBehaviour в этом игровом объекте и в каждом предке поведения.
GetReactionForceGets the reaction force of the joint given the specified timeStep.
GetReactionTorqueGets the reaction torque of the joint given the specified timeStep.
GetInstanceIDReturns the instance id of the object.
ToStringReturns the name of the GameObject.

Static Functions

DestroyУдаляет GameObject, Component или Asset.
DestroyImmediateDestroys the object obj immediately. You are strongly recommended to use Destroy instead.
DontDestroyOnLoadDo not destroy the target Object when loading a new Scene.
FindObjectOfTypeReturns the first active loaded object of Type type.
FindObjectsOfTypeReturns a list of all active loaded objects of Type type.
InstantiateClones the object original and returns the clone.

Operators

boolDoes the object exist?
operator !=Compares if two objects refer to a different object.
operator ==Compares two object references to see if they refer to the same object.

Messages

OnJointBreak2DCalled when a Joint2D attached to the same game object breaks.