PrismaticJoint
Declaration
public class tainicom.Aether.Physics2D.Dynamics.Joints.PrismaticJoint
A prismatic joint. This joint provides one degree of freedom: translation along an axis fixed in bodyA. Relative rotation is prevented. You can use a joint limit to restrict the range of motion and a joint motor to drive the motion or to model joint friction.
Inherits: tainicom.Aether.Physics2D.Dynamics.Joints.Joint
Constructors
PrismaticJoint
This requires defining a line of motion using an axis and an anchor point. The definition uses local anchor points and a local axis so that the initial configuration can violate the constraint slightly. The joint translation is zero when the local anchor points coincide in world space. Using local anchors and a local axis helps when saving and loading a game.
void PrismaticJoint(Body bodyA, Body bodyB, Vector2 anchorA, Vector2 anchorB, Vector2 axis, bool useWorldCoordinates = false)
Parameters:
| Name | Type | Description |
|---|---|---|
bodyA |
tainicom.Aether.Physics2D.Dynamics.Body |
The first body. |
bodyB |
tainicom.Aether.Physics2D.Dynamics.Body |
The second body. |
anchorA |
Strawberry.Math.Vector2 |
The first body anchor. |
anchorB |
Strawberry.Math.Vector2 |
The second body anchor. |
axis |
Strawberry.Math.Vector2 |
The axis. |
useWorldCoordinates |
System.Boolean = false |
Set to true if you are using world coordinates as anchors. |
PrismaticJoint
void PrismaticJoint(Body bodyA, Body bodyB, Vector2 anchor, Vector2 axis, bool useWorldCoordinates = false)
Parameters:
| Name | Type | Description |
|---|---|---|
bodyA |
tainicom.Aether.Physics2D.Dynamics.Body |
|
bodyB |
tainicom.Aether.Physics2D.Dynamics.Body |
|
anchor |
Strawberry.Math.Vector2 |
|
axis |
Strawberry.Math.Vector2 |
|
useWorldCoordinates |
System.Boolean = false |
Properties
LocalAnchorA
The local anchor point on BodyA
Vector2 LocalAnchorA { get set }
LocalAnchorB
The local anchor point on BodyB
Vector2 LocalAnchorB { get set }
WorldAnchorA override
Vector2 WorldAnchorA { get set }
WorldAnchorB override
Vector2 WorldAnchorB { get set }
JointTranslation
Get the current joint translation, usually in meters.
float JointTranslation { get }
JointSpeed
Get the current joint translation speed, usually in meters per second.
float JointSpeed { get }
LimitEnabled
Is the joint limit enabled?
bool LimitEnabled { get set }
Value: true if [limit enabled]; otherwise, false.
LowerLimit
Get the lower joint limit, usually in meters.
float LowerLimit { get set }
UpperLimit
Get the upper joint limit, usually in meters.
float UpperLimit { get set }
MotorEnabled
Is the joint motor enabled?
bool MotorEnabled { get set }
Value: true if [motor enabled]; otherwise, false.
MotorSpeed
Set the motor speed, usually in meters per second.
float MotorSpeed { get set }
Value: The speed.
MaxMotorForce
Set the maximum motor force, usually in N.
float MaxMotorForce { get set }
Value: The force.
MotorImpulse
Get the current motor impulse, usually in N.
float MotorImpulse { get set }
Axis
The axis at which the joint moves.
Vector2 Axis { get set }
LocalXAxis
The axis in local coordinates relative to BodyA
Vector2 LocalXAxis { get }
ReferenceAngle
The reference angle.
float ReferenceAngle { get set }
Methods
SetLimits
Set the joint limits, usually in meters.
void SetLimits(float lower, float upper)
Parameters:
| Name | Type | Description |
|---|---|---|
lower |
System.Single |
The lower limit |
upper |
System.Single |
The upper limit |
GetMotorForce
Gets the motor force.
float GetMotorForce(float invDt)
Parameters:
| Name | Type | Description |
|---|---|---|
invDt |
System.Single |
The inverse delta time |
GetReactionForce override
Vector2 GetReactionForce(float invDt)
Parameters:
| Name | Type | Description |
|---|---|---|
invDt |
System.Single |
GetReactionTorque override
float GetReactionTorque(float invDt)
Parameters:
| Name | Type | Description |
|---|---|---|
invDt |
System.Single |