2021-05-11 18:30:36 -07:00

15 KiB
Raw Permalink Blame History

Planck.js API Doc › Globals › PrismaticJoint

Class: 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.

Hierarchy

  • Joint

    ↳ PrismaticJoint

Index

Constructors

Properties

Methods

Constructors

constructor

+ new PrismaticJoint(def: PrismaticJointDef): PrismaticJoint

Overrides Joint.constructor

Defined in src/dynamics/joint/PrismaticJoint.ts:156

Parameters:

Name Type
def PrismaticJointDef

Returns: PrismaticJoint

+ new PrismaticJoint(def: PrismaticJointOpt, bodyA: Body, bodyB: Body, anchor: Vec2, axis: Vec2): PrismaticJoint

Overrides Joint.constructor

Defined in src/dynamics/joint/PrismaticJoint.ts:158

Parameters:

Name Type
def PrismaticJointOpt
bodyA Body
bodyB Body
anchor Vec2
axis Vec2

Returns: PrismaticJoint

Properties

Static TYPE

▪ TYPE: "prismatic-joint" = 'prismatic-joint' as 'prismatic-joint'

Defined in src/dynamics/joint/PrismaticJoint.ts:125

Methods

enableLimit

▸ enableLimit(flag: boolean): void

Defined in src/dynamics/joint/PrismaticJoint.ts:403

Enable/disable the joint limit.

Parameters:

Name Type
flag boolean

Returns: void


enableMotor

▸ enableMotor(flag: boolean): void

Defined in src/dynamics/joint/PrismaticJoint.ts:450

Enable/disable the joint motor.

Parameters:

Name Type
flag boolean

Returns: void


getAnchorA

▸ getAnchorA(): Vec2

Overrides Joint.getAnchorA

Defined in src/dynamics/joint/PrismaticJoint.ts:495

Get the anchor point on bodyA in world coordinates.

Returns: Vec2


getAnchorB

▸ getAnchorB(): Vec2

Overrides Joint.getAnchorB

Defined in src/dynamics/joint/PrismaticJoint.ts:502

Get the anchor point on bodyB in world coordinates.

Returns: Vec2


getBodyA

▸ getBodyA(): Body

Inherited from Joint.getBodyA

Defined in src/dynamics/Joint.ts:159

Get the first body attached to this joint.

Returns: Body


getBodyB

▸ getBodyB(): Body

Inherited from Joint.getBodyB

Defined in src/dynamics/Joint.ts:166

Get the second body attached to this joint.

Returns: Body


getCollideConnected

▸ getCollideConnected(): boolean

Inherited from Joint.getCollideConnected

Defined in src/dynamics/Joint.ts:190

Get collide connected. Note: modifying the collide connect flag won't work correctly because the flag is only checked when fixture AABBs begin to overlap.

Returns: boolean


getJointSpeed

▸ getJointSpeed(): number

Defined in src/dynamics/joint/PrismaticJoint.ts:372

Get the current joint translation speed, usually in meters per second.

Returns: number


getJointTranslation

▸ getJointTranslation(): number

Defined in src/dynamics/joint/PrismaticJoint.ts:359

Get the current joint translation, usually in meters.

Returns: number


getLocalAnchorA

▸ getLocalAnchorA(): Vec2

Defined in src/dynamics/joint/PrismaticJoint.ts:331

The local anchor point relative to bodyA's origin.

Returns: Vec2


getLocalAnchorB

▸ getLocalAnchorB(): Vec2

Defined in src/dynamics/joint/PrismaticJoint.ts:338

The local anchor point relative to bodyB's origin.

Returns: Vec2


getLocalAxisA

▸ getLocalAxisA(): Vec2

Defined in src/dynamics/joint/PrismaticJoint.ts:345

The local joint axis relative to bodyA.

Returns: Vec2


getLowerLimit

▸ getLowerLimit(): number

Defined in src/dynamics/joint/PrismaticJoint.ts:415

Get the lower joint limit, usually in meters.

Returns: number


getMaxMotorForce

▸ getMaxMotorForce(): number

Defined in src/dynamics/joint/PrismaticJoint.ts:474

Returns: number


getMotorForce

▸ getMotorForce(inv_dt: number): number

Defined in src/dynamics/joint/PrismaticJoint.ts:488

Get the current motor force given the inverse time step, usually in N.

Parameters:

Name Type
inv_dt number

Returns: number


getMotorSpeed

▸ getMotorSpeed(): number

Defined in src/dynamics/joint/PrismaticJoint.ts:481

Get the motor speed, usually in meters per second.

Returns: number


getNext

▸ getNext(): Joint

Inherited from Joint.getNext

Defined in src/dynamics/Joint.ts:173

Get the next joint the world joint list.

Returns: Joint


getReactionForce

▸ getReactionForce(inv_dt: number): Vec2

Overrides Joint.getReactionForce

Defined in src/dynamics/joint/PrismaticJoint.ts:509

Get the reaction force on bodyB at the joint anchor in Newtons.

Parameters:

Name Type
inv_dt number

Returns: Vec2


getReactionTorque

▸ getReactionTorque(inv_dt: number): number

Overrides Joint.getReactionTorque

Defined in src/dynamics/joint/PrismaticJoint.ts:516

Get the reaction torque on bodyB in N*m.

Parameters:

Name Type
inv_dt number

Returns: number


getReferenceAngle

▸ getReferenceAngle(): number

Defined in src/dynamics/joint/PrismaticJoint.ts:352

Get the reference angle.

Returns: number


getType

▸ getType(): string

Inherited from Joint.getType

Defined in src/dynamics/Joint.ts:152

Get the type of the concrete joint.

Returns: string


getUpperLimit

▸ getUpperLimit(): number

Defined in src/dynamics/joint/PrismaticJoint.ts:422

Get the upper joint limit, usually in meters.

Returns: number


getUserData

▸ getUserData(): unknown

Inherited from Joint.getUserData

Defined in src/dynamics/Joint.ts:177

Returns: unknown


initVelocityConstraints

▸ initVelocityConstraints(step: TimeStep): void

Overrides Joint.initVelocityConstraints

Defined in src/dynamics/joint/PrismaticJoint.ts:520

Parameters:

Name Type
step TimeStep

Returns: void


isActive

▸ isActive(): boolean

Inherited from Joint.isActive

Defined in src/dynamics/Joint.ts:145

Short-cut function to determine if either body is inactive.

Returns: boolean


isLimitEnabled

▸ isLimitEnabled(): boolean

Defined in src/dynamics/joint/PrismaticJoint.ts:396

Is the joint limit enabled?

Returns: boolean


isMotorEnabled

▸ isMotorEnabled(): boolean

Defined in src/dynamics/joint/PrismaticJoint.ts:443

Is the joint motor enabled?

Returns: boolean


setLimits

▸ setLimits(lower: number, upper: number): void

Defined in src/dynamics/joint/PrismaticJoint.ts:429

Set the joint limits, usually in meters.

Parameters:

Name Type
lower number
upper number

Returns: void


setMaxMotorForce

▸ setMaxMotorForce(force: number): void

Defined in src/dynamics/joint/PrismaticJoint.ts:468

Set the maximum motor force, usually in N.

Parameters:

Name Type
force number

Returns: void


setMotorSpeed

▸ setMotorSpeed(speed: number): void

Defined in src/dynamics/joint/PrismaticJoint.ts:459

Set the motor speed, usually in meters per second.

Parameters:

Name Type
speed number

Returns: void


setUserData

▸ setUserData(data: unknown): void

Inherited from Joint.setUserData

Defined in src/dynamics/Joint.ts:181

Parameters:

Name Type
data unknown

Returns: void


shiftOrigin

▸ shiftOrigin(newOrigin: Vec2): void

Inherited from Joint.shiftOrigin

Defined in src/dynamics/Joint.ts:217

Shift the origin for any points stored in world coordinates.

Parameters:

Name Type
newOrigin Vec2

Returns: void


solvePositionConstraints

▸ solvePositionConstraints(step: TimeStep): boolean

Overrides Joint.solvePositionConstraints

Defined in src/dynamics/joint/PrismaticJoint.ts:752

This returns true if the position errors are within tolerance.

Parameters:

Name Type
step TimeStep

Returns: boolean


solveVelocityConstraints

▸ solveVelocityConstraints(step: TimeStep): void

Overrides Joint.solveVelocityConstraints

Defined in src/dynamics/joint/PrismaticJoint.ts:652

Parameters:

Name Type
step TimeStep

Returns: void