lovr.physics.newDistanceJoint

Edit

Creates a new DistanceJoint.



Arguments

NameTypeDescription
colliderACollider The first collider to attach the Joint to, or nil to attach the joint to a fixed position in the World.
colliderBCollider The second collider to attach the Joint to.
x1number The x position of the first anchor point, in world coordinates.
y1number The y position of the first anchor point, in world coordinates.
z1number The z position of the first anchor point, in world coordinates.
x2number The x position of the second anchor point, in world coordinates.
y2number The y position of the second anchor point, in world coordinates.
z2number The z position of the second anchor point, in world coordinates.

Returns

NameTypeDescription
jointDistanceJoint The new DistanceJoint.

Arguments

NameTypeDescription
colliderACollider The first collider to attach the Joint to, or nil to attach the joint to a fixed position in the World.
colliderBCollider The second collider to attach the Joint to.
firstVec3 The first anchor point, in world coordinates.
secondVec3 The second anchor point, in world coordinates.

Returns

NameTypeDescription
jointDistanceJoint The new DistanceJoint.

Notes

A distance joint tries to keep the two colliders a fixed distance apart. The distance is determined by the initial distance between the anchor points. The joint allows for rotation on the anchor points.

If no anchors are given, they default to the positions of the Colliders.

See also