SpringJoint
The spring joint ties together 2 rigid bodies, spring forces will be automatically applied to keep the object at the given distance.
Read time 7 minutesLast updated 2 days ago
Definition
- Type: Class
- Namespace: UnityEngine
- Assembly: UnityEngine.PhysicsModule
- Inherits from: Joint
[RequireComponent(typeof(Rigidbody))]public class SpringJoint : Joint
Remarks
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
Property | Description |
|---|---|
| damper | The damper force used to dampen the spring force. |
| maxDistance | The maximum distance between the bodies relative to their initial distance. |
| minDistance | The minimum distance between the bodies relative to their initial distance. |
| spring | The spring force used to keep the two objects together. |
| tolerance | The maximum allowed error between the current spring length and the length defined by _minDistance and _maxDistance. |
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. |