Version: 2019.4
LanguageEnglish
  • C#

SpringJoint

class in UnityEngine

/

Inherits from:Joint

/

Implemented in:UnityEngine.PhysicsModule

Suggest a change

Success!

Thank you for helping us improve the quality of Unity Documentation. Although we cannot accept all submissions, we do read each suggested change from our users and will make updates where applicable.

Close

Submission failed

For some reason your suggested change could not be submitted. Please <a>try again</a> in a few minutes. And thank you for taking the time to help us improve the quality of Unity Documentation.

Close

Cancel

Switch to Manual

Description

The spring joint ties together 2 rigid bodies, spring forces will be automatically applied to keep the object at the given distance.

The Spring attempts to maintain the distance it has when it starts out. So if your joint's start at a rest position where the two rigidbodies are far apart, then the joint will attempt to maintain that distance. The minDistance and maxDistance properties add on top of this implicit distance.

Properties

damperThe damper force used to dampen the spring force.
maxDistanceThe maximum distance between the bodies relative to their initial distance.
minDistanceThe minimum distance between the bodies relative to their initial distance.
springThe spring force used to keep the two objects together.
toleranceThe maximum allowed error between the current spring length and the length defined by minDistance and maxDistance.

Inherited Members

Properties

gameObjectThe game object this component is attached to. A component is always attached to a game object.
tagThe tag of this game object.
transformThe Transform attached to this GameObject.
anchorThe Position of the anchor around which the joints motion is constrained.
autoConfigureConnectedAnchorShould the connectedAnchor be calculated automatically?
axisThe Direction of the axis around which the body is constrained.
breakForceThe force that needs to be applied for this joint to break.
breakTorqueThe torque that needs to be applied for this joint to break. To be able to break, a joint must be _Locked_ or _Limited_ on the axis of rotation where the torque is being applied. This means that some joints cannot break, such as an unconstrained Configurable Joint.
connectedAnchorPosition of the anchor relative to the connected Rigidbody.
connectedBodyA reference to another rigidbody this joint connects to.
connectedMassScaleThe scale to apply to the inverse mass and inertia tensor of the connected body prior to solving the constraints.
currentForceThe force applied by the solver to satisfy all constraints.
currentTorqueThe torque applied by the solver to satisfy all constraints.
enableCollisionEnable collision between bodies connected with the joint.
enablePreprocessingToggle preprocessing for this joint.
massScaleThe scale to apply to the inverse mass and inertia tensor of the body prior to solving the constraints.
hideFlagsShould the object be hidden, saved with the Scene or modifiable by the user?
nameThe name of the object.

Public Methods

BroadcastMessageCalls the method named methodName on every MonoBehaviour in this game object or any of its children.
CompareTagIs this game object tagged with tag ?
GetComponentReturns the component of Type type if the game object has one attached, null if it doesn't.
GetComponentInChildrenReturns the component of Type type in the GameObject or any of its children using depth first search.
GetComponentInParentReturns the component of Type type in the GameObject or any of its parents.
GetComponentsReturns all components of Type type in the GameObject.
GetComponentsInChildrenReturns all components of Type type in the GameObject or any of its children using depth first search. Works recursively.
GetComponentsInParentReturns all components of Type type in the GameObject or any of its parents.
SendMessageCalls the method named methodName on every MonoBehaviour in this game object.
SendMessageUpwardsCalls the method named methodName on every MonoBehaviour in this game object and on every ancestor of the behaviour.
TryGetComponentGets the component of the specified type, if it exists.
GetInstanceIDReturns the instance id of the object.
ToStringReturns the name of the object.

Static Methods

DestroyRemoves a GameObject, component or 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

OnJointBreakCalled when a joint attached to the same game object broke.
Copyright © 2023 Unity Technologies
优美缔软件(上海)有限公司 版权所有
"Unity"、Unity 徽标及其他 Unity 商标是 Unity Technologies 或其附属机构在美国及其他地区的商标或注册商标。其他名称或品牌是其各自所有者的商标。
公安部备案号:
31010902002961