Table of Contents

Class WheelJoint

Namespace
Alis.Core.Physic.Dynamics.Joints
Assembly
Alis.dll

A wheel joint. This joint provides two degrees of freedom: translation along an axis fixed in bodyA and rotation in the plane. You can use a joint limit to restrict the range of motion and a joint motor to drive the rotation or to model rotational friction. This joint is designed for vehicle suspensions.

public class WheelJoint : Joint

Inheritance

Inherited Members

Remarks

Linear constraint (point-to-line) d = pB - pA = xB + rB - xA - rA C = dot(ay, d) Cdot = dot(d, cross(wA, ay)) + dot(ay, vB + cross(wB, rB) - vA - cross(wA, rA)) = -dot(ay, vA) - dot(cross(d + rA, ay), wA) + dot(ay, vB) + dot(cross(rB, ay), vB) J = [-ay, -cross(d + rA, ay), ay, cross(rB, ay)] Spring linear constraint C = dot(ax, d) Cdot = = -dot(ax, vA) - dot(cross(d + rA, ax), wA) + dot(ax, vB) + dot(cross(rB, ax), vB) J = [-ax -cross(d+rA, ax) ax cross(rB, ax)] Motor rotational constraint Cdot = wB - wA J = [0 0 -1 0 0 1]

Constructors

WheelJoint()

Initializes a new instance of the Alis.Core.Physic.Dynamics.Joints.WheelJoint class

internal WheelJoint()

WheelJoint(Body, Body, Vector2, Vector2, bool)

Constructor for WheelJoint

public WheelJoint(Body bodyA, Body bodyB, Vector2 anchor, Vector2 axis, bool useWorldCoordinates = false)

Parameters

bodyA Body

The first body

bodyB Body

The second body

anchor Vector2

The anchor point

axis Vector2

The axis

useWorldCoordinates bool

Set to true if you are using world coordinates as anchors.

Fields

_ax

The ay

private Vector2 _ax

Field Value

Vector2

_axis

The axis

private Vector2 _axis

Field Value

Vector2

_ay

The ay

private Vector2 _ay

Field Value

Vector2

_bias

The bias

private float _bias

Field Value

float

_enableMotor

The enable motor

private bool _enableMotor

Field Value

bool

_gamma

The gamma

private float _gamma

Field Value

float

_impulse

The impulse

private float _impulse

Field Value

float

_indexA

The index

private int _indexA

Field Value

int

_indexB

The index

private int _indexB

Field Value

int

_invMassA

The inv mass

private float _invMassA

Field Value

float

_invMassB

The inv mass

private float _invMassB

Field Value

float

_localCenterA

The local center

private Vector2 _localCenterA

Field Value

Vector2

_localCenterB

The local center

private Vector2 _localCenterB

Field Value

Vector2

_localXAxis

The local axis

private Vector2 _localXAxis

Field Value

Vector2

_localYAxis

The local axis

private Vector2 _localYAxis

Field Value

Vector2

_mass

The mass

private float _mass

Field Value

float

_maxMotorTorque

The max motor torque

private float _maxMotorTorque

Field Value

float

_motorImpulse

The motor impulse

private float _motorImpulse

Field Value

float

_motorMass

The motor mass

private float _motorMass

Field Value

float

_motorSpeed

The motor speed

private float _motorSpeed

Field Value

float

_sAx

The bx

private float _sAx

Field Value

float

_sAy

The by

private float _sAy

Field Value

float

_sBx

The bx

private float _sBx

Field Value

float

_sBy

The by

private float _sBy

Field Value

float

_springImpulse

The spring impulse

private float _springImpulse

Field Value

float

_springMass

The spring mass

private float _springMass

Field Value

float

invIa

The inv ia

private float invIa

Field Value

float

invIb

The inv ib

private float invIb

Field Value

float

Properties

Axis

The axis at which the suspension moves.

public Vector2 Axis { get; set; }

Property Value

Vector2

DampingRatio

Suspension damping ratio, one indicates critical damping

public float DampingRatio { get; set; }

Property Value

float

Frequency

Suspension frequency, zero indicates no suspension

public float Frequency { get; set; }

Property Value

float

JointSpeed

Gets the angular velocity of the joint

public float JointSpeed { get; }

Property Value

float

JointTranslation

Gets the translation along the axis

public float JointTranslation { get; }

Property Value

float

LocalAnchorA

The local anchor point on BodyA

public Vector2 LocalAnchorA { get; set; }

Property Value

Vector2

LocalAnchorB

The local anchor point on BodyB

public Vector2 LocalAnchorB { get; set; }

Property Value

Vector2

LocalXAxis

The axis in local coordinates relative to BodyA

public Vector2 LocalXAxis { get; }

Property Value

Vector2

MaxMotorTorque

The maximum motor torque, usually in N-m.

public float MaxMotorTorque { get; set; }

Property Value

float

MotorEnabled

Enable/disable the joint motor.

public bool MotorEnabled { get; set; }

Property Value

bool

MotorSpeed

The desired motor speed in radians per second.

public float MotorSpeed { get; set; }

Property Value

float

WorldAnchorA

Gets or sets the value of the world anchor a

public override Vector2 WorldAnchorA { get; set; }

Property Value

Vector2

WorldAnchorB

Gets or sets the value of the world anchor b

public override Vector2 WorldAnchorB { get; set; }

Property Value

Vector2

Methods

GetMotorTorque(float)

Gets the torque of the motor

public float GetMotorTorque(float invDt)

Parameters

invDt float

inverse delta time

Returns

float

GetReactionForce(float)

Gets the reaction force using the specified inv dt

public override Vector2 GetReactionForce(float invDt)

Parameters

invDt float

The inv dt

Returns

Vector2

The vector

GetReactionTorque(float)

Gets the reaction torque using the specified inv dt

public override float GetReactionTorque(float invDt)

Parameters

invDt float

The inv dt

Returns

float

The float

InitVelocityConstraints(ref SolverData)

Inits the velocity constraints using the specified data

internal override void InitVelocityConstraints(ref SolverData data)

Parameters

data SolverData

The data

SolvePositionConstraints(ref SolverData)

Describes whether this instance solve position constraints

internal override bool SolvePositionConstraints(ref SolverData data)

Parameters

data SolverData

The data

Returns

bool

The bool

SolveVelocityConstraints(ref SolverData)

Solves the velocity constraints using the specified data

internal override void SolveVelocityConstraints(ref SolverData data)

Parameters

data SolverData

The data