Class RopeJoint
- Namespace
- Alis.Core.Physic.Dynamics.Joints
- Assembly
- Alis.dll
A rope joint enforces a maximum distance between two points on two bodies. It has no other effect. It can be used on ropes that are made up of several connected bodies, and if there is a need to support a heavy body. This joint is used for stabiliation of heavy objects on soft constraint joints. Warning: if you attempt to change the maximum length during the simulation you will get some non-physical behavior. Use the DistanceJoint instead if you want to dynamically control the length.
public class RopeJoint : JointInheritance
Inherited Members
Remarks
Limit: C = norm(pB - pA) - L u = (pB - pA) / norm(pB - pA) Cdot = dot(u, vB + cross(wB, rB) - vA - cross(wA, rA)) J = [-u -cross(rA, u) u cross(rB, u)] K = J * invM * JT = invMassA + invIA * cross(rA, u)^2 + invMassB + invIB * cross(rB, u)^2
Constructors
RopeJoint()
Initializes a new instance of the Alis.Core.Physic.Dynamics.Joints.RopeJoint class
internal RopeJoint()RopeJoint(Body, Body, Vector2, Vector2, bool)
Constructor for RopeJoint.
public RopeJoint(Body bodyA, Body bodyB, Vector2 anchorA, Vector2 anchorB, bool useWorldCoordinates = false)Parameters
bodyABody-
The first body
bodyBBody-
The second body
anchorAVector2-
The anchor on the first body
anchorBVector2-
The anchor on the second body
useWorldCoordinatesbool-
Set to true if you are using world coordinates as anchors.
Fields
_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
_length
The length
private float _lengthField Value
_localCenterA
The local center
private Vector2 _localCenterAField Value
_localCenterB
The local center
private Vector2 _localCenterBField Value
_mass
The mass
private float _massField Value
_rA
The
private Vector2 _rAField Value
_rB
The
private Vector2 _rBField Value
_u
The
private Vector2 _uField Value
invIa
The inv ia
private float invIaField Value
invIb
The inv ib
private float invIbField Value
Properties
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
MaxLength
Get or set the maximum length of the rope. By default, it is the distance between the two anchor points.
public float MaxLength { get; set; }Property Value
State
Gets the state of the joint.
public LimitState State { get; private set; }Property Value
WorldAnchorA
Gets or sets the value of the world anchor a
public override sealed Vector2 WorldAnchorA { get; set; }Property Value
WorldAnchorB
Gets or sets the value of the world anchor b
public override sealed 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
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