DampedSpringJoint2D
A physics joint that connects two 2D physics bodies with a spring-like force.
DampedSpringJoint2D.swift:11class DampedSpringJoint2D
A physics joint that connects two 2D physics bodies with a spring-like force. This resembles a spring that always wants to stretch to a given length.
Superclasses
class Joint2D
Abstract base class for all 2D physics joints.
Citizens in SwiftGodot
Conformances
protocol CustomStringConvertible
A type with a customized textual representation.
protocol Equatable
A type that can be compared for value equality.
protocol Hashable
A type that can be hashed into a
Hasher
to produce an integer hash value.protocol Identifiable<ID>
A class of types whose instances hold the value of an entity with stable identity.
protocol VariantRepresentable
Types that conform to VariantRepresentable can be stored directly in
Variant
with no conversion. These include all of the Variant types from Godot (for exampleGString
,Rect
,Plane
), Godot objects (those that subclass SwiftGodot.Object) as well as the built-in Swift types UInt8, Int64 and Double.protocol VariantStorable
Types that conform to VariantStorable can be stored in a Variant and can be extracted back out of a Variant.
Type members
Instance members
var damping: Double
The spring joint’s damping ratio. A value between
0
and1
. When the two bodies move into different directions the system tries to align them to the spring axis again. A highdamping
value forces the attached bodies to align faster.var length: Double
The spring joint’s maximum length. The two attached bodies cannot stretch it past this value.
var restLength: Double
When the bodies attached to the spring joint move they stretch or squash it. The joint always tries to resize towards this length.
var stiffness: Double
The higher the value, the less the bodies attached to the joint will deform it. The joint applies an opposing force to the bodies, the product of the stiffness multiplied by the size difference from its resting length.