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

14 KiB
Raw Permalink Blame History

Planck.js API Doc › Globals › WheelJoint

Class: WheelJoint

A wheel joint. This joint provides two degrees of freedom: translation along an axis fixed in bodyA and rotation in the plane. In other words, it is a point to line constraint with a rotational motor and a linear spring/damper. This joint is designed for vehicle suspensions.

Hierarchy

Index

Constructors

Properties

Methods

Constructors

constructor

+ new WheelJoint(def: WheelJointDef): WheelJoint

Overrides Joint.constructor

Defined in src/dynamics/joint/WheelJoint.ts:141

Parameters:

Name Type
def WheelJointDef

Returns: WheelJoint

+ new WheelJoint(def: WheelJointOpt, bodyA: Body, bodyB: Body, anchor: Vec2, axis: Vec2): WheelJoint

Overrides Joint.constructor

Defined in src/dynamics/joint/WheelJoint.ts:143

Parameters:

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

Returns: WheelJoint

Properties

Static TYPE

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

Defined in src/dynamics/joint/WheelJoint.ts:103

Methods

enableMotor

▸ enableMotor(flag: boolean): void

Defined in src/dynamics/joint/WheelJoint.ts:328

Enable/disable the joint motor.

Parameters:

Name Type
flag boolean

Returns: void


getAnchorA

▸ getAnchorA(): Vec2

Overrides Joint.getAnchorA

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

Get the anchor point on bodyA in world coordinates.

Returns: Vec2


getAnchorB

▸ getAnchorB(): Vec2

Overrides Joint.getAnchorB

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

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/WheelJoint.ts:312

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

Returns: number


getJointTranslation

▸ getJointTranslation(): number

Defined in src/dynamics/joint/WheelJoint.ts:296

Get the current joint translation, usually in meters.

Returns: number


getLocalAnchorA

▸ getLocalAnchorA(): Vec2

Defined in src/dynamics/joint/WheelJoint.ts:275

The local anchor point relative to bodyA's origin.

Returns: Vec2


getLocalAnchorB

▸ getLocalAnchorB(): Vec2

Defined in src/dynamics/joint/WheelJoint.ts:282

The local anchor point relative to bodyB's origin.

Returns: Vec2


getLocalAxisA

▸ getLocalAxisA(): Vec2

Defined in src/dynamics/joint/WheelJoint.ts:289

The local joint axis relative to bodyA.

Returns: Vec2


getMaxMotorTorque

▸ getMaxMotorTorque(): number

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

Returns: number


getMotorSpeed

▸ getMotorSpeed(): number

Defined in src/dynamics/joint/WheelJoint.ts:346

Get the motor speed, usually in radians per second.

Returns: number


getMotorTorque

▸ getMotorTorque(inv_dt: number): number

Defined in src/dynamics/joint/WheelJoint.ts:366

Get the current motor torque given the inverse time step, usually in N-m.

Parameters:

Name Type
inv_dt number

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/WheelJoint.ts:410

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/WheelJoint.ts:417

Get the reaction torque on bodyB in N*m.

Parameters:

Name Type
inv_dt number

Returns: number


getSpringDampingRatio

▸ getSpringDampingRatio(): number

Defined in src/dynamics/joint/WheelJoint.ts:389

Returns: number


getSpringFrequencyHz

▸ getSpringFrequencyHz(): number

Defined in src/dynamics/joint/WheelJoint.ts:378

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


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/WheelJoint.ts:421

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


isMotorEnabled

▸ isMotorEnabled(): boolean

Defined in src/dynamics/joint/WheelJoint.ts:321

Is the joint motor enabled?

Returns: boolean


setMaxMotorTorque

▸ setMaxMotorTorque(torque: number): void

Defined in src/dynamics/joint/WheelJoint.ts:353

Set/Get the maximum motor force, usually in N-m.

Parameters:

Name Type
torque number

Returns: void


setMotorSpeed

▸ setMotorSpeed(speed: number): void

Defined in src/dynamics/joint/WheelJoint.ts:337

Set the motor speed, usually in radians per second.

Parameters:

Name Type
speed number

Returns: void


setSpringDampingRatio

▸ setSpringDampingRatio(ratio: number): void

Defined in src/dynamics/joint/WheelJoint.ts:385

Set/Get the spring damping ratio

Parameters:

Name Type
ratio number

Returns: void


setSpringFrequencyHz

▸ setSpringFrequencyHz(hz: number): void

Defined in src/dynamics/joint/WheelJoint.ts:374

Set/Get the spring frequency in hertz. Setting the frequency to zero disables the spring.

Parameters:

Name Type
hz 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/WheelJoint.ts:623

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/WheelJoint.ts:551

Parameters:

Name Type
step TimeStep

Returns: void