Attention: Here be dragons

This is the latest (unstable) version of this documentation, which may document features not available in or compatible with released stable versions of Godot.

DampedSpringJoint2D

繼承: Joint2D < Node2D < CanvasItem < Node < Object

通過類似彈簧的力連接兩個 2D 物理物體的物理關節。

說明

A physics joint that connects two 2D physics bodies with a spring-like force. This behaves like a spring that always wants to stretch to a given length.

屬性

float

damping

1.0

float

length

50.0

float

rest_length

0.0

float

stiffness

20.0


屬性說明

float damping = 1.0 🔗

  • void set_damping(value: float)

  • float get_damping()

The spring joint's damping ratio. A value between 0 and 1. When the two bodies move into different directions the system tries to align them to the spring axis again. A high damping value forces the attached bodies to align faster.


float length = 50.0 🔗

  • void set_length(value: float)

  • float get_length()

彈簧關節的最大長度。兩個連接體不能超過這個值。


float rest_length = 0.0 🔗

  • void set_rest_length(value: float)

  • float get_rest_length()

當連接到彈簧關節的機構移動時,它們會拉伸或擠壓它。關節總是嘗試向這個長度調整。


float stiffness = 20.0 🔗

  • void set_stiffness(value: float)

  • float get_stiffness()

該值越大,連接在關節上的機構變形越小。關節對各機構施加一個相反的力,即剛度乘以與其靜止長度的大小差的乘積。