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
_axis
The axis
private Vector2 _axis
Field Value
_ay
The ay
private Vector2 _ay
Field Value
_bias
The bias
private float _bias
Field Value
_enableMotor
The enable motor
private bool _enableMotor
Field Value
_gamma
The gamma
private float _gamma
Field Value
_impulse
The impulse
private float _impulse
Field Value
_indexA
The index
private int _indexA
Field Value
_indexB
The index
private int _indexB
Field Value
_invMassA
The inv mass
private float _invMassA
Field Value
_invMassB
The inv mass
private float _invMassB
Field Value
_localCenterA
The local center
private Vector2 _localCenterA
Field Value
_localCenterB
The local center
private Vector2 _localCenterB
Field Value
_localXAxis
The local axis
private Vector2 _localXAxis
Field Value
_localYAxis
The local axis
private Vector2 _localYAxis
Field Value
_mass
The mass
private float _mass
Field Value
_maxMotorTorque
The max motor torque
private float _maxMotorTorque
Field Value
_motorImpulse
The motor impulse
private float _motorImpulse
Field Value
_motorMass
The motor mass
private float _motorMass
Field Value
_motorSpeed
The motor speed
private float _motorSpeed
Field Value
_sAx
The bx
private float _sAx
Field Value
_sAy
The by
private float _sAy
Field Value
_sBx
The bx
private float _sBx
Field Value
_sBy
The by
private float _sBy
Field Value
_springImpulse
The spring impulse
private float _springImpulse
Field Value
_springMass
The spring mass
private float _springMass
Field Value
invIa
The inv ia
private float invIa
Field Value
invIb
The inv ib
private float invIb
Field 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
invDt
float-
inverse delta time
Returns
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