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 : Joint
Inheritance
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
bodyA
Body-
The first body
bodyB
Body-
The second body
anchorA
Vector2-
The anchor on the first body
anchorB
Vector2-
The anchor on the second body
useWorldCoordinates
bool-
Set to true if you are using world coordinates as anchors.
Fields
_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
_length
The length
private float _length
Field Value
_localCenterA
The local center
private Vector2 _localCenterA
Field Value
_localCenterB
The local center
private Vector2 _localCenterB
Field Value
_mass
The mass
private float _mass
Field Value
_rA
The
private Vector2 _rA
Field Value
_rB
The
private Vector2 _rB
Field Value
_u
The
private Vector2 _u
Field Value
invIa
The inv ia
private float invIa
Field Value
invIb
The inv ib
private float invIb
Field 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
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