Ctrl+K

DistanceJoint

Declaration

public class tainicom.Aether.Physics2D.Dynamics.Joints.DistanceJoint

A distance joint rains two points on two bodies to remain at a fixed distance from each other. You can view this as a massless, rigid rod.

Inherits: tainicom.Aether.Physics2D.Dynamics.Joints.Joint

Constructors

DistanceJoint

This requires defining an anchor point on both bodies and the non-zero length of the distance joint. If you don't supply a length, the local anchor points is used so that the initial configuration can violate the constraint slightly. This helps when saving and loading a game. Warning Do not use a zero or short length.

void DistanceJoint(Body bodyA, Body bodyB, Vector2 anchorA, Vector2 anchorB, bool useWorldCoordinates = false)

Parameters:

Name Type Description
bodyA tainicom.Aether.Physics2D.Dynamics.Body The first body
bodyB tainicom.Aether.Physics2D.Dynamics.Body The second body
anchorA Strawberry.Math.Vector2 The first body anchor
anchorB Strawberry.Math.Vector2 The second body anchor
useWorldCoordinates System.Boolean = false Set to true if you are using world coordinates as anchors.

Properties

LocalAnchorA

The local anchor point relative to bodyA's origin.

Vector2 LocalAnchorA { get set }

LocalAnchorB

The local anchor point relative to bodyB's origin.

Vector2 LocalAnchorB { get set }

WorldAnchorA override sealed

Vector2 WorldAnchorA { get set }

WorldAnchorB override sealed

Vector2 WorldAnchorB { get set }

Length

The natural length between the anchor points. Manipulating the length can lead to non-physical behavior when the frequency is zero.

float Length { get set }

Frequency

The mass-spring-damper frequency in Hertz. A value of 0 disables softness.

float Frequency { get set }

DampingRatio

The damping ratio. 0 = no damping, 1 = critical damping.

float DampingRatio { get set }

Methods

GetReactionForce override

Get the reaction force given the inverse time step. Unit is N.

Vector2 GetReactionForce(float invDt)

Parameters:

Name Type Description
invDt System.Single

GetReactionTorque override

Get the reaction torque given the inverse time step. Unit is N*m. This is always zero for a distance joint.

float GetReactionTorque(float invDt)

Parameters:

Name Type Description
invDt System.Single