Class SimulationJoints2D
Joints2D for a Box2DSimulation: the same factories with the world id filled in, and overloads that take the entities the simulation created bodies for. Reached through Joints.
public sealed class SimulationJoints2D
- Inheritance
-
SimulationJoints2D
Methods
CreateDistance(B2BodyId, B2BodyId, Vector2, Vector2, DistanceJointOptions?)
A rod between two anchors, one on each body. The rest length defaults to their distance at creation; a spring makes it soft, a limit with a spring makes it a rope.
public B2JointId CreateDistance(B2BodyId a, B2BodyId b, Vector2 worldAnchorA, Vector2 worldAnchorB, DistanceJointOptions? options = null)
Parameters
aB2BodyIdbB2BodyIdworldAnchorAVector2worldAnchorBVector2optionsDistanceJointOptions
Returns
- B2JointId
CreateDistance(Entity, Entity, Vector2, Vector2, DistanceJointOptions?)
A rod between two anchors, one on each body. The rest length defaults to their distance at creation; a spring makes it soft, a limit with a spring makes it a rope.
public B2JointId CreateDistance(Entity a, Entity b, Vector2 worldAnchorA, Vector2 worldAnchorB, DistanceJointOptions? options = null)
Parameters
aEntitybEntityworldAnchorAVector2worldAnchorBVector2optionsDistanceJointOptions
Returns
- B2JointId
CreateFilter(B2BodyId, B2BodyId)
No constraint at all: the two bodies simply never collide with each other. For the links of a chain or the parts of a ragdoll.
public B2JointId CreateFilter(B2BodyId a, B2BodyId b)
Parameters
aB2BodyIdbB2BodyId
Returns
- B2JointId
CreateFilter(Entity, Entity)
No constraint at all: the two bodies simply never collide with each other. For the links of a chain or the parts of a ragdoll.
public B2JointId CreateFilter(Entity a, Entity b)
Parameters
Returns
- B2JointId
CreateMotor(B2BodyId, B2BodyId, Vector2?, MotorJointOptions?)
Drives b relative to a. With a pivot, both frames sit
there and the spring pulls that point on B toward that point on A - the mouse-drag shape;
without one, the frames are the body origins.
public B2JointId CreateMotor(B2BodyId a, B2BodyId b, Vector2? worldPivot = null, MotorJointOptions? options = null)
Parameters
aB2BodyIdbB2BodyIdworldPivotVector2?optionsMotorJointOptions
Returns
- B2JointId
CreateMotor(Entity, Entity, Vector2?, MotorJointOptions?)
Drives b relative to a. With a pivot, both frames sit
there and the spring pulls that point on B toward that point on A - the mouse-drag shape;
without one, the frames are the body origins.
public B2JointId CreateMotor(Entity a, Entity b, Vector2? worldPivot = null, MotorJointOptions? options = null)
Parameters
aEntitybEntityworldPivotVector2?optionsMotorJointOptions
Returns
- B2JointId
CreatePrismatic(B2BodyId, B2BodyId, Vector2, Vector2, PrismaticJointOptions?)
A slider: b moves along worldAxis through
worldPivot, fixed in a's frame, without turning.
public B2JointId CreatePrismatic(B2BodyId a, B2BodyId b, Vector2 worldPivot, Vector2 worldAxis, PrismaticJointOptions? options = null)
Parameters
aB2BodyIdbB2BodyIdworldPivotVector2worldAxisVector2optionsPrismaticJointOptions
Returns
- B2JointId
CreatePrismatic(Entity, Entity, Vector2, Vector2, PrismaticJointOptions?)
A slider: b moves along worldAxis through
worldPivot, fixed in a's frame, without turning.
public B2JointId CreatePrismatic(Entity a, Entity b, Vector2 worldPivot, Vector2 worldAxis, PrismaticJointOptions? options = null)
Parameters
aEntitybEntityworldPivotVector2worldAxisVector2optionsPrismaticJointOptions
Returns
- B2JointId
CreateRevolute(B2BodyId, B2BodyId, Vector2, RevoluteJointOptions?)
A hinge at worldPivot: the bodies turn about it and nothing else.
public B2JointId CreateRevolute(B2BodyId a, B2BodyId b, Vector2 worldPivot, RevoluteJointOptions? options = null)
Parameters
aB2BodyIdbB2BodyIdworldPivotVector2optionsRevoluteJointOptions
Returns
- B2JointId
CreateRevolute(Entity, Entity, Vector2, RevoluteJointOptions?)
A hinge at worldPivot: the bodies turn about it and nothing else.
public B2JointId CreateRevolute(Entity a, Entity b, Vector2 worldPivot, RevoluteJointOptions? options = null)
Parameters
aEntitybEntityworldPivotVector2optionsRevoluteJointOptions
Returns
- B2JointId
CreateWeld(B2BodyId, B2BodyId, Vector2, WeldJointOptions?)
Glues the bodies together at worldPivot in their current relative pose.
public B2JointId CreateWeld(B2BodyId a, B2BodyId b, Vector2 worldPivot, WeldJointOptions? options = null)
Parameters
aB2BodyIdbB2BodyIdworldPivotVector2optionsWeldJointOptions
Returns
- B2JointId
CreateWeld(Entity, Entity, Vector2, WeldJointOptions?)
Glues the bodies together at worldPivot in their current relative pose.
public B2JointId CreateWeld(Entity a, Entity b, Vector2 worldPivot, WeldJointOptions? options = null)
Parameters
aEntitybEntityworldPivotVector2optionsWeldJointOptions
Returns
- B2JointId
CreateWheel(B2BodyId, B2BodyId, Vector2, Vector2, WheelJointOptions?)
A wheel on a suspension: wheel turns about worldPivot
and slides along worldAxis - the suspension direction, usually straight
up - relative to chassis.
public B2JointId CreateWheel(B2BodyId chassis, B2BodyId wheel, Vector2 worldPivot, Vector2 worldAxis, WheelJointOptions? options = null)
Parameters
chassisB2BodyIdwheelB2BodyIdworldPivotVector2worldAxisVector2optionsWheelJointOptions
Returns
- B2JointId
CreateWheel(Entity, Entity, Vector2, Vector2, WheelJointOptions?)
A wheel on a suspension: wheel turns about worldPivot
and slides along worldAxis - the suspension direction, usually straight
up - relative to chassis.
public B2JointId CreateWheel(Entity chassis, Entity wheel, Vector2 worldPivot, Vector2 worldAxis, WheelJointOptions? options = null)
Parameters
chassisEntitywheelEntityworldPivotVector2worldAxisVector2optionsWheelJointOptions
Returns
- B2JointId
Destroy(B2JointId, bool)
Removes a joint. Safe on a joint that is already gone.
[SuppressMessage("Performance", "CA1822:Mark members as static", Justification = "Part of the simulation.Joints facade; a static member would send the caller to Joints2D for the same call.")]
public void Destroy(B2JointId joint, bool wakeBodies = true)
Parameters
jointB2JointIdThe joint.
wakeBodiesboolWake the bodies it connected, so they react to being freed.
GetAnchors(B2JointId)
The joint's two anchors in world space right now, for drawing it. They coincide for a hinge or a weld and sit apart for a rod.
[SuppressMessage("Performance", "CA1822:Mark members as static", Justification = "Part of the simulation.Joints facade; a static member would send the caller to Joints2D for the same call.")]
public (Vector2 A, Vector2 B) GetAnchors(B2JointId joint)
Parameters
jointB2JointId
Returns
IsValid(B2JointId)
Whether the joint still exists - it goes when either body is destroyed.
[SuppressMessage("Performance", "CA1822:Mark members as static", Justification = "Part of the simulation.Joints facade; a static member would send the caller to Joints2D for the same call.")]
public bool IsValid(B2JointId joint)
Parameters
jointB2JointId