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 : JointInheritance
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
bodyABody-
The first body
bodyBBody-
The second body
anchorVector2-
The anchor point
axisVector2-
The axis
useWorldCoordinatesbool-
Set to true if you are using world coordinates as anchors.
Fields
_ax
The ay
private Vector2 _axField Value
_axis
The axis
private Vector2 _axisField Value
_ay
The ay
private Vector2 _ayField Value
_bias
The bias
private float _biasField Value
_enableMotor
The enable motor
private bool _enableMotorField Value
_gamma
The gamma
private float _gammaField Value
_impulse
The impulse
private float _impulseField Value
_indexA
The index
private int _indexAField Value
_indexB
The index
private int _indexBField Value
_invMassA
The inv mass
private float _invMassAField Value
_invMassB
The inv mass
private float _invMassBField Value
_localCenterA
The local center
private Vector2 _localCenterAField Value
_localCenterB
The local center
private Vector2 _localCenterBField Value
_localXAxis
The local axis
private Vector2 _localXAxisField Value
_localYAxis
The local axis
private Vector2 _localYAxisField Value
_mass
The mass
private float _massField Value
_maxMotorTorque
The max motor torque
private float _maxMotorTorqueField Value
_motorImpulse
The motor impulse
private float _motorImpulseField Value
_motorMass
The motor mass
private float _motorMassField Value
_motorSpeed
The motor speed
private float _motorSpeedField Value
_sAx
The bx
private float _sAxField Value
_sAy
The by
private float _sAyField Value
_sBx
The bx
private float _sBxField Value
_sBy
The by
private float _sByField Value
_springImpulse
The spring impulse
private float _springImpulseField Value
_springMass
The spring mass
private float _springMassField Value
invIa
The inv ia
private float invIaField Value
invIb
The inv ib
private float invIbField Value
Properties
Axis
The axis at which the suspension moves.
public Vector2 Axis { get; set; }Property Value
DampingRatio
Suspension damping ratio, one indicates critical damping
public float DampingRatio { get; set; }Property Value
Frequency
Suspension frequency, zero indicates no suspension
public float Frequency { get; set; }Property Value
JointSpeed
Gets the angular velocity of the joint
public float JointSpeed { get; }Property Value
JointTranslation
Gets the translation along the axis
public float JointTranslation { get; }Property Value
LocalAnchorA
The local anchor point on BodyA
public Vector2 LocalAnchorA { get; set; }Property Value
LocalAnchorB
The local anchor point on BodyB
public Vector2 LocalAnchorB { get; set; }Property Value
LocalXAxis
The axis in local coordinates relative to BodyA
public Vector2 LocalXAxis { get; }Property Value
MaxMotorTorque
The maximum motor torque, usually in N-m.
public float MaxMotorTorque { get; set; }Property Value
MotorEnabled
Enable/disable the joint motor.
public bool MotorEnabled { get; set; }Property Value
MotorSpeed
The desired motor speed in radians per second.
public float MotorSpeed { get; set; }Property Value
WorldAnchorA
Gets or sets the value of the world anchor a
public override Vector2 WorldAnchorA { get; set; }Property Value
WorldAnchorB
Gets or sets the value of the world anchor b
public override Vector2 WorldAnchorB { get; set; }Property Value
Methods
GetMotorTorque(float)
Gets the torque of the motor
public float GetMotorTorque(float invDt)Parameters
invDtfloat-
inverse delta time
Returns
GetReactionForce(float)
Gets the reaction force using the specified inv dt
public override Vector2 GetReactionForce(float invDt)Parameters
invDtfloat-
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
invDtfloat-
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
dataSolverData-
The data
SolvePositionConstraints(ref SolverData)
Describes whether this instance solve position constraints
internal override bool SolvePositionConstraints(ref SolverData data)Parameters
dataSolverData-
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
dataSolverData-
The data