2020-07-28 20:21:55 -07:00
|
|
|
|
[Planck.js API Doc](../README.md) › [Globals](../globals.md) › [WheelJoint](wheeljoint.md)
|
|
|
|
|
|
|
|
|
|
|
|
# Class: WheelJoint
|
|
|
|
|
|
|
2021-04-16 17:10:15 +02:00
|
|
|
|
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.
|
|
|
|
|
|
|
2020-07-28 20:21:55 -07:00
|
|
|
|
## Hierarchy
|
|
|
|
|
|
|
2021-05-02 17:18:33 -07:00
|
|
|
|
* [Joint](joint.md)
|
2021-04-16 17:10:15 +02:00
|
|
|
|
|
2020-07-28 20:21:55 -07:00
|
|
|
|
↳ **WheelJoint**
|
|
|
|
|
|
|
|
|
|
|
|
## Index
|
|
|
|
|
|
|
|
|
|
|
|
### Constructors
|
|
|
|
|
|
|
|
|
|
|
|
* [constructor](wheeljoint.md#constructor)
|
|
|
|
|
|
|
|
|
|
|
|
### Properties
|
|
|
|
|
|
|
|
|
|
|
|
* [TYPE](wheeljoint.md#static-type)
|
|
|
|
|
|
|
|
|
|
|
|
### Methods
|
|
|
|
|
|
|
|
|
|
|
|
* [enableMotor](wheeljoint.md#enablemotor)
|
2021-04-16 17:10:15 +02:00
|
|
|
|
* [getAnchorA](wheeljoint.md#getanchora)
|
|
|
|
|
|
* [getAnchorB](wheeljoint.md#getanchorb)
|
|
|
|
|
|
* [getBodyA](wheeljoint.md#getbodya)
|
|
|
|
|
|
* [getBodyB](wheeljoint.md#getbodyb)
|
|
|
|
|
|
* [getCollideConnected](wheeljoint.md#getcollideconnected)
|
2020-07-28 20:21:55 -07:00
|
|
|
|
* [getJointSpeed](wheeljoint.md#getjointspeed)
|
|
|
|
|
|
* [getJointTranslation](wheeljoint.md#getjointtranslation)
|
|
|
|
|
|
* [getLocalAnchorA](wheeljoint.md#getlocalanchora)
|
|
|
|
|
|
* [getLocalAnchorB](wheeljoint.md#getlocalanchorb)
|
|
|
|
|
|
* [getLocalAxisA](wheeljoint.md#getlocalaxisa)
|
|
|
|
|
|
* [getMaxMotorTorque](wheeljoint.md#getmaxmotortorque)
|
|
|
|
|
|
* [getMotorSpeed](wheeljoint.md#getmotorspeed)
|
|
|
|
|
|
* [getMotorTorque](wheeljoint.md#getmotortorque)
|
2021-04-16 17:10:15 +02:00
|
|
|
|
* [getNext](wheeljoint.md#getnext)
|
|
|
|
|
|
* [getReactionForce](wheeljoint.md#getreactionforce)
|
|
|
|
|
|
* [getReactionTorque](wheeljoint.md#getreactiontorque)
|
2020-07-28 20:21:55 -07:00
|
|
|
|
* [getSpringDampingRatio](wheeljoint.md#getspringdampingratio)
|
|
|
|
|
|
* [getSpringFrequencyHz](wheeljoint.md#getspringfrequencyhz)
|
2021-04-16 17:10:15 +02:00
|
|
|
|
* [getType](wheeljoint.md#gettype)
|
|
|
|
|
|
* [getUserData](wheeljoint.md#getuserdata)
|
|
|
|
|
|
* [initVelocityConstraints](wheeljoint.md#initvelocityconstraints)
|
|
|
|
|
|
* [isActive](wheeljoint.md#isactive)
|
2020-07-28 20:21:55 -07:00
|
|
|
|
* [isMotorEnabled](wheeljoint.md#ismotorenabled)
|
|
|
|
|
|
* [setMaxMotorTorque](wheeljoint.md#setmaxmotortorque)
|
|
|
|
|
|
* [setMotorSpeed](wheeljoint.md#setmotorspeed)
|
|
|
|
|
|
* [setSpringDampingRatio](wheeljoint.md#setspringdampingratio)
|
|
|
|
|
|
* [setSpringFrequencyHz](wheeljoint.md#setspringfrequencyhz)
|
2021-04-16 17:10:15 +02:00
|
|
|
|
* [setUserData](wheeljoint.md#setuserdata)
|
|
|
|
|
|
* [shiftOrigin](wheeljoint.md#shiftorigin)
|
|
|
|
|
|
* [solvePositionConstraints](wheeljoint.md#solvepositionconstraints)
|
|
|
|
|
|
* [solveVelocityConstraints](wheeljoint.md#solvevelocityconstraints)
|
2020-07-28 20:21:55 -07:00
|
|
|
|
|
|
|
|
|
|
## Constructors
|
|
|
|
|
|
|
|
|
|
|
|
### constructor
|
|
|
|
|
|
|
|
|
|
|
|
\+ **new WheelJoint**(`def`: [WheelJointDef](../interfaces/wheeljointdef.md)): *[WheelJoint](wheeljoint.md)*
|
|
|
|
|
|
|
2021-05-02 17:18:33 -07:00
|
|
|
|
*Overrides [Joint](joint.md).[constructor](joint.md#constructor)*
|
2021-04-16 17:10:15 +02:00
|
|
|
|
|
2021-05-11 18:30:36 -07:00
|
|
|
|
*Defined in [src/dynamics/joint/WheelJoint.ts:141](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/joint/WheelJoint.ts#L141)*
|
2020-07-28 20:21:55 -07:00
|
|
|
|
|
|
|
|
|
|
**Parameters:**
|
|
|
|
|
|
|
|
|
|
|
|
Name | Type |
|
|
|
|
|
|
------ | ------ |
|
|
|
|
|
|
`def` | [WheelJointDef](../interfaces/wheeljointdef.md) |
|
|
|
|
|
|
|
|
|
|
|
|
**Returns:** *[WheelJoint](wheeljoint.md)*
|
|
|
|
|
|
|
|
|
|
|
|
\+ **new WheelJoint**(`def`: [WheelJointOpt](../interfaces/wheeljointopt.md), `bodyA`: [Body](body.md), `bodyB`: [Body](body.md), `anchor`: [Vec2](vec2.md), `axis`: [Vec2](vec2.md)): *[WheelJoint](wheeljoint.md)*
|
|
|
|
|
|
|
2021-05-02 17:18:33 -07:00
|
|
|
|
*Overrides [Joint](joint.md).[constructor](joint.md#constructor)*
|
2021-04-16 17:10:15 +02:00
|
|
|
|
|
2021-05-11 18:30:36 -07:00
|
|
|
|
*Defined in [src/dynamics/joint/WheelJoint.ts:143](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/joint/WheelJoint.ts#L143)*
|
2020-07-28 20:21:55 -07:00
|
|
|
|
|
|
|
|
|
|
**Parameters:**
|
|
|
|
|
|
|
|
|
|
|
|
Name | Type |
|
|
|
|
|
|
------ | ------ |
|
|
|
|
|
|
`def` | [WheelJointOpt](../interfaces/wheeljointopt.md) |
|
|
|
|
|
|
`bodyA` | [Body](body.md) |
|
|
|
|
|
|
`bodyB` | [Body](body.md) |
|
|
|
|
|
|
`anchor` | [Vec2](vec2.md) |
|
|
|
|
|
|
`axis` | [Vec2](vec2.md) |
|
|
|
|
|
|
|
|
|
|
|
|
**Returns:** *[WheelJoint](wheeljoint.md)*
|
|
|
|
|
|
|
|
|
|
|
|
## Properties
|
|
|
|
|
|
|
|
|
|
|
|
### `Static` TYPE
|
|
|
|
|
|
|
2021-04-16 17:10:15 +02:00
|
|
|
|
▪ **TYPE**: *"wheel-joint"* = 'wheel-joint' as 'wheel-joint'
|
|
|
|
|
|
|
2021-05-11 18:30:36 -07:00
|
|
|
|
*Defined in [src/dynamics/joint/WheelJoint.ts:103](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/joint/WheelJoint.ts#L103)*
|
2020-07-28 20:21:55 -07:00
|
|
|
|
|
|
|
|
|
|
## Methods
|
|
|
|
|
|
|
|
|
|
|
|
### enableMotor
|
|
|
|
|
|
|
2021-05-11 18:30:36 -07:00
|
|
|
|
▸ **enableMotor**(`flag`: boolean): *void*
|
2020-07-28 20:21:55 -07:00
|
|
|
|
|
2021-05-11 18:30:36 -07:00
|
|
|
|
*Defined in [src/dynamics/joint/WheelJoint.ts:328](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/joint/WheelJoint.ts#L328)*
|
2021-04-16 17:10:15 +02:00
|
|
|
|
|
|
|
|
|
|
Enable/disable the joint motor.
|
2020-07-28 20:21:55 -07:00
|
|
|
|
|
|
|
|
|
|
**Parameters:**
|
|
|
|
|
|
|
|
|
|
|
|
Name | Type |
|
|
|
|
|
|
------ | ------ |
|
2021-05-11 18:30:36 -07:00
|
|
|
|
`flag` | boolean |
|
2020-07-28 20:21:55 -07:00
|
|
|
|
|
|
|
|
|
|
**Returns:** *void*
|
|
|
|
|
|
|
|
|
|
|
|
___
|
|
|
|
|
|
|
2021-04-16 17:10:15 +02:00
|
|
|
|
### getAnchorA
|
|
|
|
|
|
|
2021-05-11 18:30:36 -07:00
|
|
|
|
▸ **getAnchorA**(): *[Vec2](vec2.md)*
|
2021-04-16 17:10:15 +02:00
|
|
|
|
|
2021-05-02 17:18:33 -07:00
|
|
|
|
*Overrides [Joint](joint.md).[getAnchorA](joint.md#abstract-getanchora)*
|
2021-04-16 17:10:15 +02:00
|
|
|
|
|
2021-05-11 18:30:36 -07:00
|
|
|
|
*Defined in [src/dynamics/joint/WheelJoint.ts:396](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/joint/WheelJoint.ts#L396)*
|
2021-04-16 17:10:15 +02:00
|
|
|
|
|
|
|
|
|
|
Get the anchor point on bodyA in world coordinates.
|
|
|
|
|
|
|
2021-05-11 18:30:36 -07:00
|
|
|
|
**Returns:** *[Vec2](vec2.md)*
|
2021-04-16 17:10:15 +02:00
|
|
|
|
|
|
|
|
|
|
___
|
|
|
|
|
|
|
|
|
|
|
|
### getAnchorB
|
|
|
|
|
|
|
2021-05-11 18:30:36 -07:00
|
|
|
|
▸ **getAnchorB**(): *[Vec2](vec2.md)*
|
2021-04-16 17:10:15 +02:00
|
|
|
|
|
2021-05-02 17:18:33 -07:00
|
|
|
|
*Overrides [Joint](joint.md).[getAnchorB](joint.md#abstract-getanchorb)*
|
2021-04-16 17:10:15 +02:00
|
|
|
|
|
2021-05-11 18:30:36 -07:00
|
|
|
|
*Defined in [src/dynamics/joint/WheelJoint.ts:403](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/joint/WheelJoint.ts#L403)*
|
2021-04-16 17:10:15 +02:00
|
|
|
|
|
|
|
|
|
|
Get the anchor point on bodyB in world coordinates.
|
|
|
|
|
|
|
2021-05-11 18:30:36 -07:00
|
|
|
|
**Returns:** *[Vec2](vec2.md)*
|
2021-04-16 17:10:15 +02:00
|
|
|
|
|
|
|
|
|
|
___
|
|
|
|
|
|
|
|
|
|
|
|
### getBodyA
|
|
|
|
|
|
|
2021-05-11 18:30:36 -07:00
|
|
|
|
▸ **getBodyA**(): *[Body](body.md)*
|
2021-04-16 17:10:15 +02:00
|
|
|
|
|
2021-05-02 17:18:33 -07:00
|
|
|
|
*Inherited from [Joint](joint.md).[getBodyA](joint.md#getbodya)*
|
2021-04-16 17:10:15 +02:00
|
|
|
|
|
2021-05-11 18:30:36 -07:00
|
|
|
|
*Defined in [src/dynamics/Joint.ts:159](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/Joint.ts#L159)*
|
2021-04-16 17:10:15 +02:00
|
|
|
|
|
|
|
|
|
|
Get the first body attached to this joint.
|
|
|
|
|
|
|
2021-05-11 18:30:36 -07:00
|
|
|
|
**Returns:** *[Body](body.md)*
|
2021-04-16 17:10:15 +02:00
|
|
|
|
|
|
|
|
|
|
___
|
|
|
|
|
|
|
|
|
|
|
|
### getBodyB
|
|
|
|
|
|
|
2021-05-11 18:30:36 -07:00
|
|
|
|
▸ **getBodyB**(): *[Body](body.md)*
|
2021-04-16 17:10:15 +02:00
|
|
|
|
|
2021-05-02 17:18:33 -07:00
|
|
|
|
*Inherited from [Joint](joint.md).[getBodyB](joint.md#getbodyb)*
|
2021-04-16 17:10:15 +02:00
|
|
|
|
|
2021-05-11 18:30:36 -07:00
|
|
|
|
*Defined in [src/dynamics/Joint.ts:166](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/Joint.ts#L166)*
|
2021-04-16 17:10:15 +02:00
|
|
|
|
|
|
|
|
|
|
Get the second body attached to this joint.
|
|
|
|
|
|
|
2021-05-11 18:30:36 -07:00
|
|
|
|
**Returns:** *[Body](body.md)*
|
2021-04-16 17:10:15 +02:00
|
|
|
|
|
|
|
|
|
|
___
|
|
|
|
|
|
|
|
|
|
|
|
### getCollideConnected
|
|
|
|
|
|
|
|
|
|
|
|
▸ **getCollideConnected**(): *boolean*
|
|
|
|
|
|
|
2021-05-02 17:18:33 -07:00
|
|
|
|
*Inherited from [Joint](joint.md).[getCollideConnected](joint.md#getcollideconnected)*
|
2021-04-16 17:10:15 +02:00
|
|
|
|
|
2021-05-11 18:30:36 -07:00
|
|
|
|
*Defined in [src/dynamics/Joint.ts:190](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/Joint.ts#L190)*
|
2021-04-16 17:10:15 +02:00
|
|
|
|
|
|
|
|
|
|
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*
|
|
|
|
|
|
|
|
|
|
|
|
___
|
|
|
|
|
|
|
2020-07-28 20:21:55 -07:00
|
|
|
|
### getJointSpeed
|
|
|
|
|
|
|
|
|
|
|
|
▸ **getJointSpeed**(): *number*
|
|
|
|
|
|
|
2021-05-11 18:30:36 -07:00
|
|
|
|
*Defined in [src/dynamics/joint/WheelJoint.ts:312](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/joint/WheelJoint.ts#L312)*
|
2021-04-16 17:10:15 +02:00
|
|
|
|
|
|
|
|
|
|
Get the current joint translation speed, usually in meters per second.
|
2020-07-28 20:21:55 -07:00
|
|
|
|
|
|
|
|
|
|
**Returns:** *number*
|
|
|
|
|
|
|
|
|
|
|
|
___
|
|
|
|
|
|
|
|
|
|
|
|
### getJointTranslation
|
|
|
|
|
|
|
|
|
|
|
|
▸ **getJointTranslation**(): *number*
|
|
|
|
|
|
|
2021-05-11 18:30:36 -07:00
|
|
|
|
*Defined in [src/dynamics/joint/WheelJoint.ts:296](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/joint/WheelJoint.ts#L296)*
|
2021-04-16 17:10:15 +02:00
|
|
|
|
|
|
|
|
|
|
Get the current joint translation, usually in meters.
|
2020-07-28 20:21:55 -07:00
|
|
|
|
|
|
|
|
|
|
**Returns:** *number*
|
|
|
|
|
|
|
|
|
|
|
|
___
|
|
|
|
|
|
|
|
|
|
|
|
### getLocalAnchorA
|
|
|
|
|
|
|
2021-05-11 18:30:36 -07:00
|
|
|
|
▸ **getLocalAnchorA**(): *[Vec2](vec2.md)*
|
2020-07-28 20:21:55 -07:00
|
|
|
|
|
2021-05-11 18:30:36 -07:00
|
|
|
|
*Defined in [src/dynamics/joint/WheelJoint.ts:275](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/joint/WheelJoint.ts#L275)*
|
2021-04-16 17:10:15 +02:00
|
|
|
|
|
|
|
|
|
|
The local anchor point relative to bodyA's origin.
|
2020-07-28 20:21:55 -07:00
|
|
|
|
|
2021-05-11 18:30:36 -07:00
|
|
|
|
**Returns:** *[Vec2](vec2.md)*
|
2020-07-28 20:21:55 -07:00
|
|
|
|
|
|
|
|
|
|
___
|
|
|
|
|
|
|
|
|
|
|
|
### getLocalAnchorB
|
|
|
|
|
|
|
2021-05-11 18:30:36 -07:00
|
|
|
|
▸ **getLocalAnchorB**(): *[Vec2](vec2.md)*
|
2020-07-28 20:21:55 -07:00
|
|
|
|
|
2021-05-11 18:30:36 -07:00
|
|
|
|
*Defined in [src/dynamics/joint/WheelJoint.ts:282](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/joint/WheelJoint.ts#L282)*
|
2021-04-16 17:10:15 +02:00
|
|
|
|
|
|
|
|
|
|
The local anchor point relative to bodyB's origin.
|
2020-07-28 20:21:55 -07:00
|
|
|
|
|
2021-05-11 18:30:36 -07:00
|
|
|
|
**Returns:** *[Vec2](vec2.md)*
|
2020-07-28 20:21:55 -07:00
|
|
|
|
|
|
|
|
|
|
___
|
|
|
|
|
|
|
|
|
|
|
|
### getLocalAxisA
|
|
|
|
|
|
|
2021-05-11 18:30:36 -07:00
|
|
|
|
▸ **getLocalAxisA**(): *[Vec2](vec2.md)*
|
2020-07-28 20:21:55 -07:00
|
|
|
|
|
2021-05-11 18:30:36 -07:00
|
|
|
|
*Defined in [src/dynamics/joint/WheelJoint.ts:289](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/joint/WheelJoint.ts#L289)*
|
2021-04-16 17:10:15 +02:00
|
|
|
|
|
|
|
|
|
|
The local joint axis relative to bodyA.
|
2020-07-28 20:21:55 -07:00
|
|
|
|
|
2021-05-11 18:30:36 -07:00
|
|
|
|
**Returns:** *[Vec2](vec2.md)*
|
2020-07-28 20:21:55 -07:00
|
|
|
|
|
|
|
|
|
|
___
|
|
|
|
|
|
|
|
|
|
|
|
### getMaxMotorTorque
|
|
|
|
|
|
|
|
|
|
|
|
▸ **getMaxMotorTorque**(): *number*
|
|
|
|
|
|
|
2021-05-11 18:30:36 -07:00
|
|
|
|
*Defined in [src/dynamics/joint/WheelJoint.ts:359](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/joint/WheelJoint.ts#L359)*
|
2020-07-28 20:21:55 -07:00
|
|
|
|
|
|
|
|
|
|
**Returns:** *number*
|
|
|
|
|
|
|
|
|
|
|
|
___
|
|
|
|
|
|
|
|
|
|
|
|
### getMotorSpeed
|
|
|
|
|
|
|
|
|
|
|
|
▸ **getMotorSpeed**(): *number*
|
|
|
|
|
|
|
2021-05-11 18:30:36 -07:00
|
|
|
|
*Defined in [src/dynamics/joint/WheelJoint.ts:346](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/joint/WheelJoint.ts#L346)*
|
2021-04-16 17:10:15 +02:00
|
|
|
|
|
|
|
|
|
|
Get the motor speed, usually in radians per second.
|
2020-07-28 20:21:55 -07:00
|
|
|
|
|
|
|
|
|
|
**Returns:** *number*
|
|
|
|
|
|
|
|
|
|
|
|
___
|
|
|
|
|
|
|
|
|
|
|
|
### getMotorTorque
|
|
|
|
|
|
|
2021-05-11 18:30:36 -07:00
|
|
|
|
▸ **getMotorTorque**(`inv_dt`: number): *number*
|
2021-04-16 17:10:15 +02:00
|
|
|
|
|
2021-05-11 18:30:36 -07:00
|
|
|
|
*Defined in [src/dynamics/joint/WheelJoint.ts:366](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/joint/WheelJoint.ts#L366)*
|
2021-04-16 17:10:15 +02:00
|
|
|
|
|
|
|
|
|
|
Get the current motor torque given the inverse time step, usually in N-m.
|
|
|
|
|
|
|
|
|
|
|
|
**Parameters:**
|
|
|
|
|
|
|
|
|
|
|
|
Name | Type |
|
|
|
|
|
|
------ | ------ |
|
2021-05-11 18:30:36 -07:00
|
|
|
|
`inv_dt` | number |
|
2021-04-16 17:10:15 +02:00
|
|
|
|
|
|
|
|
|
|
**Returns:** *number*
|
|
|
|
|
|
|
|
|
|
|
|
___
|
|
|
|
|
|
|
|
|
|
|
|
### getNext
|
|
|
|
|
|
|
2021-05-11 18:30:36 -07:00
|
|
|
|
▸ **getNext**(): *[Joint](joint.md)*
|
2021-04-16 17:10:15 +02:00
|
|
|
|
|
2021-05-02 17:18:33 -07:00
|
|
|
|
*Inherited from [Joint](joint.md).[getNext](joint.md#getnext)*
|
2021-04-16 17:10:15 +02:00
|
|
|
|
|
2021-05-11 18:30:36 -07:00
|
|
|
|
*Defined in [src/dynamics/Joint.ts:173](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/Joint.ts#L173)*
|
2021-04-16 17:10:15 +02:00
|
|
|
|
|
|
|
|
|
|
Get the next joint the world joint list.
|
|
|
|
|
|
|
2021-05-11 18:30:36 -07:00
|
|
|
|
**Returns:** *[Joint](joint.md)*
|
2021-04-16 17:10:15 +02:00
|
|
|
|
|
|
|
|
|
|
___
|
|
|
|
|
|
|
|
|
|
|
|
### getReactionForce
|
|
|
|
|
|
|
2021-05-11 18:30:36 -07:00
|
|
|
|
▸ **getReactionForce**(`inv_dt`: number): *[Vec2](vec2.md)*
|
2020-07-28 20:21:55 -07:00
|
|
|
|
|
2021-05-02 17:18:33 -07:00
|
|
|
|
*Overrides [Joint](joint.md).[getReactionForce](joint.md#abstract-getreactionforce)*
|
2021-04-16 17:10:15 +02:00
|
|
|
|
|
2021-05-11 18:30:36 -07:00
|
|
|
|
*Defined in [src/dynamics/joint/WheelJoint.ts:410](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/joint/WheelJoint.ts#L410)*
|
2021-04-16 17:10:15 +02:00
|
|
|
|
|
|
|
|
|
|
Get the reaction force on bodyB at the joint anchor in Newtons.
|
|
|
|
|
|
|
|
|
|
|
|
**Parameters:**
|
|
|
|
|
|
|
|
|
|
|
|
Name | Type |
|
|
|
|
|
|
------ | ------ |
|
2021-05-11 18:30:36 -07:00
|
|
|
|
`inv_dt` | number |
|
2021-04-16 17:10:15 +02:00
|
|
|
|
|
2021-05-11 18:30:36 -07:00
|
|
|
|
**Returns:** *[Vec2](vec2.md)*
|
2021-04-16 17:10:15 +02:00
|
|
|
|
|
|
|
|
|
|
___
|
|
|
|
|
|
|
|
|
|
|
|
### getReactionTorque
|
|
|
|
|
|
|
2021-05-11 18:30:36 -07:00
|
|
|
|
▸ **getReactionTorque**(`inv_dt`: number): *number*
|
2021-04-16 17:10:15 +02:00
|
|
|
|
|
2021-05-02 17:18:33 -07:00
|
|
|
|
*Overrides [Joint](joint.md).[getReactionTorque](joint.md#abstract-getreactiontorque)*
|
2021-04-16 17:10:15 +02:00
|
|
|
|
|
2021-05-11 18:30:36 -07:00
|
|
|
|
*Defined in [src/dynamics/joint/WheelJoint.ts:417](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/joint/WheelJoint.ts#L417)*
|
2021-04-16 17:10:15 +02:00
|
|
|
|
|
|
|
|
|
|
Get the reaction torque on bodyB in N*m.
|
2020-07-28 20:21:55 -07:00
|
|
|
|
|
|
|
|
|
|
**Parameters:**
|
|
|
|
|
|
|
|
|
|
|
|
Name | Type |
|
|
|
|
|
|
------ | ------ |
|
2021-05-11 18:30:36 -07:00
|
|
|
|
`inv_dt` | number |
|
2020-07-28 20:21:55 -07:00
|
|
|
|
|
|
|
|
|
|
**Returns:** *number*
|
|
|
|
|
|
|
|
|
|
|
|
___
|
|
|
|
|
|
|
|
|
|
|
|
### getSpringDampingRatio
|
|
|
|
|
|
|
|
|
|
|
|
▸ **getSpringDampingRatio**(): *number*
|
|
|
|
|
|
|
2021-05-11 18:30:36 -07:00
|
|
|
|
*Defined in [src/dynamics/joint/WheelJoint.ts:389](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/joint/WheelJoint.ts#L389)*
|
2020-07-28 20:21:55 -07:00
|
|
|
|
|
|
|
|
|
|
**Returns:** *number*
|
|
|
|
|
|
|
|
|
|
|
|
___
|
|
|
|
|
|
|
|
|
|
|
|
### getSpringFrequencyHz
|
|
|
|
|
|
|
|
|
|
|
|
▸ **getSpringFrequencyHz**(): *number*
|
|
|
|
|
|
|
2021-05-11 18:30:36 -07:00
|
|
|
|
*Defined in [src/dynamics/joint/WheelJoint.ts:378](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/joint/WheelJoint.ts#L378)*
|
2020-07-28 20:21:55 -07:00
|
|
|
|
|
|
|
|
|
|
**Returns:** *number*
|
|
|
|
|
|
|
|
|
|
|
|
___
|
|
|
|
|
|
|
2021-04-16 17:10:15 +02:00
|
|
|
|
### getType
|
|
|
|
|
|
|
|
|
|
|
|
▸ **getType**(): *string*
|
|
|
|
|
|
|
2021-05-02 17:18:33 -07:00
|
|
|
|
*Inherited from [Joint](joint.md).[getType](joint.md#gettype)*
|
2021-04-16 17:10:15 +02:00
|
|
|
|
|
2021-05-11 18:30:36 -07:00
|
|
|
|
*Defined in [src/dynamics/Joint.ts:152](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/Joint.ts#L152)*
|
2021-04-16 17:10:15 +02:00
|
|
|
|
|
|
|
|
|
|
Get the type of the concrete joint.
|
|
|
|
|
|
|
|
|
|
|
|
**Returns:** *string*
|
|
|
|
|
|
|
|
|
|
|
|
___
|
|
|
|
|
|
|
|
|
|
|
|
### getUserData
|
|
|
|
|
|
|
|
|
|
|
|
▸ **getUserData**(): *unknown*
|
|
|
|
|
|
|
2021-05-02 17:18:33 -07:00
|
|
|
|
*Inherited from [Joint](joint.md).[getUserData](joint.md#getuserdata)*
|
2021-04-16 17:10:15 +02:00
|
|
|
|
|
2021-05-11 18:30:36 -07:00
|
|
|
|
*Defined in [src/dynamics/Joint.ts:177](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/Joint.ts#L177)*
|
2021-04-16 17:10:15 +02:00
|
|
|
|
|
|
|
|
|
|
**Returns:** *unknown*
|
|
|
|
|
|
|
|
|
|
|
|
___
|
|
|
|
|
|
|
|
|
|
|
|
### initVelocityConstraints
|
|
|
|
|
|
|
2021-05-11 18:30:36 -07:00
|
|
|
|
▸ **initVelocityConstraints**(`step`: [TimeStep](timestep.md)): *void*
|
2021-04-16 17:10:15 +02:00
|
|
|
|
|
2021-05-02 17:18:33 -07:00
|
|
|
|
*Overrides [Joint](joint.md).[initVelocityConstraints](joint.md#abstract-initvelocityconstraints)*
|
2021-04-16 17:10:15 +02:00
|
|
|
|
|
2021-05-11 18:30:36 -07:00
|
|
|
|
*Defined in [src/dynamics/joint/WheelJoint.ts:421](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/joint/WheelJoint.ts#L421)*
|
2021-04-16 17:10:15 +02:00
|
|
|
|
|
|
|
|
|
|
**Parameters:**
|
|
|
|
|
|
|
|
|
|
|
|
Name | Type |
|
|
|
|
|
|
------ | ------ |
|
2021-05-11 18:30:36 -07:00
|
|
|
|
`step` | [TimeStep](timestep.md) |
|
2021-04-16 17:10:15 +02:00
|
|
|
|
|
|
|
|
|
|
**Returns:** *void*
|
|
|
|
|
|
|
|
|
|
|
|
___
|
|
|
|
|
|
|
|
|
|
|
|
### isActive
|
|
|
|
|
|
|
|
|
|
|
|
▸ **isActive**(): *boolean*
|
|
|
|
|
|
|
2021-05-02 17:18:33 -07:00
|
|
|
|
*Inherited from [Joint](joint.md).[isActive](joint.md#isactive)*
|
2021-04-16 17:10:15 +02:00
|
|
|
|
|
2021-05-11 18:30:36 -07:00
|
|
|
|
*Defined in [src/dynamics/Joint.ts:145](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/Joint.ts#L145)*
|
2021-04-16 17:10:15 +02:00
|
|
|
|
|
|
|
|
|
|
Short-cut function to determine if either body is inactive.
|
|
|
|
|
|
|
|
|
|
|
|
**Returns:** *boolean*
|
|
|
|
|
|
|
|
|
|
|
|
___
|
|
|
|
|
|
|
2020-07-28 20:21:55 -07:00
|
|
|
|
### isMotorEnabled
|
|
|
|
|
|
|
|
|
|
|
|
▸ **isMotorEnabled**(): *boolean*
|
|
|
|
|
|
|
2021-05-11 18:30:36 -07:00
|
|
|
|
*Defined in [src/dynamics/joint/WheelJoint.ts:321](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/joint/WheelJoint.ts#L321)*
|
2021-04-16 17:10:15 +02:00
|
|
|
|
|
|
|
|
|
|
Is the joint motor enabled?
|
2020-07-28 20:21:55 -07:00
|
|
|
|
|
|
|
|
|
|
**Returns:** *boolean*
|
|
|
|
|
|
|
|
|
|
|
|
___
|
|
|
|
|
|
|
|
|
|
|
|
### setMaxMotorTorque
|
|
|
|
|
|
|
2021-05-11 18:30:36 -07:00
|
|
|
|
▸ **setMaxMotorTorque**(`torque`: number): *void*
|
2020-07-28 20:21:55 -07:00
|
|
|
|
|
2021-05-11 18:30:36 -07:00
|
|
|
|
*Defined in [src/dynamics/joint/WheelJoint.ts:353](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/joint/WheelJoint.ts#L353)*
|
2021-04-16 17:10:15 +02:00
|
|
|
|
|
|
|
|
|
|
Set/Get the maximum motor force, usually in N-m.
|
2020-07-28 20:21:55 -07:00
|
|
|
|
|
|
|
|
|
|
**Parameters:**
|
|
|
|
|
|
|
|
|
|
|
|
Name | Type |
|
|
|
|
|
|
------ | ------ |
|
2021-05-11 18:30:36 -07:00
|
|
|
|
`torque` | number |
|
2020-07-28 20:21:55 -07:00
|
|
|
|
|
|
|
|
|
|
**Returns:** *void*
|
|
|
|
|
|
|
|
|
|
|
|
___
|
|
|
|
|
|
|
|
|
|
|
|
### setMotorSpeed
|
|
|
|
|
|
|
2021-05-11 18:30:36 -07:00
|
|
|
|
▸ **setMotorSpeed**(`speed`: number): *void*
|
2021-04-16 17:10:15 +02:00
|
|
|
|
|
2021-05-11 18:30:36 -07:00
|
|
|
|
*Defined in [src/dynamics/joint/WheelJoint.ts:337](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/joint/WheelJoint.ts#L337)*
|
2020-07-28 20:21:55 -07:00
|
|
|
|
|
2021-04-16 17:10:15 +02:00
|
|
|
|
Set the motor speed, usually in radians per second.
|
2020-07-28 20:21:55 -07:00
|
|
|
|
|
|
|
|
|
|
**Parameters:**
|
|
|
|
|
|
|
|
|
|
|
|
Name | Type |
|
|
|
|
|
|
------ | ------ |
|
2021-05-11 18:30:36 -07:00
|
|
|
|
`speed` | number |
|
2020-07-28 20:21:55 -07:00
|
|
|
|
|
|
|
|
|
|
**Returns:** *void*
|
|
|
|
|
|
|
|
|
|
|
|
___
|
|
|
|
|
|
|
|
|
|
|
|
### setSpringDampingRatio
|
|
|
|
|
|
|
2021-05-11 18:30:36 -07:00
|
|
|
|
▸ **setSpringDampingRatio**(`ratio`: number): *void*
|
2020-07-28 20:21:55 -07:00
|
|
|
|
|
2021-05-11 18:30:36 -07:00
|
|
|
|
*Defined in [src/dynamics/joint/WheelJoint.ts:385](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/joint/WheelJoint.ts#L385)*
|
2021-04-16 17:10:15 +02:00
|
|
|
|
|
|
|
|
|
|
Set/Get the spring damping ratio
|
2020-07-28 20:21:55 -07:00
|
|
|
|
|
|
|
|
|
|
**Parameters:**
|
|
|
|
|
|
|
|
|
|
|
|
Name | Type |
|
|
|
|
|
|
------ | ------ |
|
2021-05-11 18:30:36 -07:00
|
|
|
|
`ratio` | number |
|
2020-07-28 20:21:55 -07:00
|
|
|
|
|
|
|
|
|
|
**Returns:** *void*
|
|
|
|
|
|
|
|
|
|
|
|
___
|
|
|
|
|
|
|
|
|
|
|
|
### setSpringFrequencyHz
|
|
|
|
|
|
|
2021-05-11 18:30:36 -07:00
|
|
|
|
▸ **setSpringFrequencyHz**(`hz`: number): *void*
|
2021-04-16 17:10:15 +02:00
|
|
|
|
|
2021-05-11 18:30:36 -07:00
|
|
|
|
*Defined in [src/dynamics/joint/WheelJoint.ts:374](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/joint/WheelJoint.ts#L374)*
|
2020-07-28 20:21:55 -07:00
|
|
|
|
|
2021-04-16 17:10:15 +02:00
|
|
|
|
Set/Get the spring frequency in hertz. Setting the frequency to zero disables
|
|
|
|
|
|
the spring.
|
2020-07-28 20:21:55 -07:00
|
|
|
|
|
|
|
|
|
|
**Parameters:**
|
|
|
|
|
|
|
|
|
|
|
|
Name | Type |
|
|
|
|
|
|
------ | ------ |
|
2021-05-11 18:30:36 -07:00
|
|
|
|
`hz` | number |
|
2020-07-28 20:21:55 -07:00
|
|
|
|
|
|
|
|
|
|
**Returns:** *void*
|
2021-04-16 17:10:15 +02:00
|
|
|
|
|
|
|
|
|
|
___
|
|
|
|
|
|
|
|
|
|
|
|
### setUserData
|
|
|
|
|
|
|
|
|
|
|
|
▸ **setUserData**(`data`: unknown): *void*
|
|
|
|
|
|
|
2021-05-02 17:18:33 -07:00
|
|
|
|
*Inherited from [Joint](joint.md).[setUserData](joint.md#setuserdata)*
|
2021-04-16 17:10:15 +02:00
|
|
|
|
|
2021-05-11 18:30:36 -07:00
|
|
|
|
*Defined in [src/dynamics/Joint.ts:181](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/Joint.ts#L181)*
|
2021-04-16 17:10:15 +02:00
|
|
|
|
|
|
|
|
|
|
**Parameters:**
|
|
|
|
|
|
|
|
|
|
|
|
Name | Type |
|
|
|
|
|
|
------ | ------ |
|
|
|
|
|
|
`data` | unknown |
|
|
|
|
|
|
|
|
|
|
|
|
**Returns:** *void*
|
|
|
|
|
|
|
|
|
|
|
|
___
|
|
|
|
|
|
|
|
|
|
|
|
### shiftOrigin
|
|
|
|
|
|
|
2021-05-02 17:18:33 -07:00
|
|
|
|
▸ **shiftOrigin**(`newOrigin`: [Vec2](vec2.md)): *void*
|
2021-04-16 17:10:15 +02:00
|
|
|
|
|
2021-05-02 17:18:33 -07:00
|
|
|
|
*Inherited from [Joint](joint.md).[shiftOrigin](joint.md#shiftorigin)*
|
2021-04-16 17:10:15 +02:00
|
|
|
|
|
2021-05-11 18:30:36 -07:00
|
|
|
|
*Defined in [src/dynamics/Joint.ts:217](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/Joint.ts#L217)*
|
2021-04-16 17:10:15 +02:00
|
|
|
|
|
|
|
|
|
|
Shift the origin for any points stored in world coordinates.
|
|
|
|
|
|
|
|
|
|
|
|
**Parameters:**
|
|
|
|
|
|
|
|
|
|
|
|
Name | Type |
|
|
|
|
|
|
------ | ------ |
|
2021-05-02 17:18:33 -07:00
|
|
|
|
`newOrigin` | [Vec2](vec2.md) |
|
2021-04-16 17:10:15 +02:00
|
|
|
|
|
|
|
|
|
|
**Returns:** *void*
|
|
|
|
|
|
|
|
|
|
|
|
___
|
|
|
|
|
|
|
|
|
|
|
|
### solvePositionConstraints
|
|
|
|
|
|
|
2021-05-11 18:30:36 -07:00
|
|
|
|
▸ **solvePositionConstraints**(`step`: [TimeStep](timestep.md)): *boolean*
|
2021-04-16 17:10:15 +02:00
|
|
|
|
|
2021-05-02 17:18:33 -07:00
|
|
|
|
*Overrides [Joint](joint.md).[solvePositionConstraints](joint.md#abstract-solvepositionconstraints)*
|
2021-04-16 17:10:15 +02:00
|
|
|
|
|
2021-05-11 18:30:36 -07:00
|
|
|
|
*Defined in [src/dynamics/joint/WheelJoint.ts:623](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/joint/WheelJoint.ts#L623)*
|
2021-04-16 17:10:15 +02:00
|
|
|
|
|
|
|
|
|
|
This returns true if the position errors are within tolerance.
|
|
|
|
|
|
|
|
|
|
|
|
**Parameters:**
|
|
|
|
|
|
|
|
|
|
|
|
Name | Type |
|
|
|
|
|
|
------ | ------ |
|
2021-05-11 18:30:36 -07:00
|
|
|
|
`step` | [TimeStep](timestep.md) |
|
2021-04-16 17:10:15 +02:00
|
|
|
|
|
|
|
|
|
|
**Returns:** *boolean*
|
|
|
|
|
|
|
|
|
|
|
|
___
|
|
|
|
|
|
|
|
|
|
|
|
### solveVelocityConstraints
|
|
|
|
|
|
|
2021-05-11 18:30:36 -07:00
|
|
|
|
▸ **solveVelocityConstraints**(`step`: [TimeStep](timestep.md)): *void*
|
2021-04-16 17:10:15 +02:00
|
|
|
|
|
2021-05-02 17:18:33 -07:00
|
|
|
|
*Overrides [Joint](joint.md).[solveVelocityConstraints](joint.md#abstract-solvevelocityconstraints)*
|
2021-04-16 17:10:15 +02:00
|
|
|
|
|
2021-05-11 18:30:36 -07:00
|
|
|
|
*Defined in [src/dynamics/joint/WheelJoint.ts:551](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/joint/WheelJoint.ts#L551)*
|
2021-04-16 17:10:15 +02:00
|
|
|
|
|
|
|
|
|
|
**Parameters:**
|
|
|
|
|
|
|
|
|
|
|
|
Name | Type |
|
|
|
|
|
|
------ | ------ |
|
2021-05-11 18:30:36 -07:00
|
|
|
|
`step` | [TimeStep](timestep.md) |
|
2021-04-16 17:10:15 +02:00
|
|
|
|
|
|
|
|
|
|
**Returns:** *void*
|