Class WeldJoint
- Namespace
- Alis.Core.Physic.Dynamics.Joints
- Assembly
- Alis.dll
A weld joint essentially glues two bodies together. A weld joint may distort somewhat because the island constraint solver is approximate. The joint is soft constraint based, which means the two bodies will move relative to each other, when a force is applied. To combine two bodies in a rigid fashion, combine the fixtures to a single body instead.
public class WeldJoint : Joint
Inheritance
Inherited Members
Remarks
Point-to-point constraint C = p2 - p1 Cdot = v2 - v1 = v2 + cross(w2, r2) - v1 - cross(w1, r1) J = [-I -r1_skew I r2_skew ] Identity used: w k % (rx i + ry j) = w * (-ry i + rx j) Angle constraint C = angle2 - angle1 - referenceAngle Cdot = w2 - w1 J = [0 0 -1 0 0 1] K = invI1 + invI2
Constructors
WeldJoint()
Initializes a new instance of the Alis.Core.Physic.Dynamics.Joints.WeldJoint class
internal WeldJoint()
WeldJoint(Body, Body, Vector2, Vector2, bool)
You need to specify an anchor point where they are attached. The position of the anchor point is important for computing the reaction torque.
public WeldJoint(Body bodyA, Body bodyB, Vector2 anchorA, Vector2 anchorB, bool useWorldCoordinates = false)
Parameters
bodyA
Body-
The first body
bodyB
Body-
The second body
anchorA
Vector2-
The first body anchor.
anchorB
Vector2-
The second body anchor.
useWorldCoordinates
bool-
Set to true if you are using world coordinates as anchors.
Fields
_bias
The bias
private float _bias
Field Value
_gamma
The gamma
private float _gamma
Field Value
_impulse
The impulse
private Vector3 _impulse
Field Value
_indexA
The index
private int _indexA
Field Value
_indexB
The index
private int _indexB
Field Value
_invIA
The inv ia
private float _invIA
Field Value
_invIB
The inv ib
private float _invIB
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
_mass
The mass
private Mat33 _mass
Field Value
_rA
The
private Vector2 _rA
Field Value
_rB
The
private Vector2 _rB
Field Value
Properties
DampingRatio
The damping on the joint. The damping is only used when the joint has a frequency (> 0). A higher value means more damping.
public float DampingRatio { get; set; }
Property Value
FrequencyHz
The frequency of the joint. A higher frequency means a stiffer joint, but a too high value can cause the joint to oscillate. Default is 0, which means the joint does no spring calculations.
public float FrequencyHz { get; set; }
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
ReferenceAngle
The bodyB angle minus bodyA angle in the reference state (radians).
public float ReferenceAngle { 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
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