2020-07-28 20:21:55 -07:00
|
|
|
|
[Planck.js API Doc](../README.md) › [Globals](../globals.md) › [RevoluteJoint](revolutejoint.md)
|
|
|
|
|
|
|
|
|
|
|
|
# Class: RevoluteJoint
|
|
|
|
|
|
|
2021-04-16 17:10:15 +02:00
|
|
|
|
A revolute joint constrains two bodies to share a common point while they are
|
|
|
|
|
|
free to rotate about the point. The relative rotation about the shared point
|
|
|
|
|
|
is the joint angle. You can limit the relative rotation with a joint limit
|
|
|
|
|
|
that specifies a lower and upper angle. You can use a motor to drive the
|
|
|
|
|
|
relative rotation about the shared point. A maximum motor torque is provided
|
|
|
|
|
|
so that infinite forces are not generated.
|
|
|
|
|
|
|
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
|
|
|
|
↳ **RevoluteJoint**
|
|
|
|
|
|
|
|
|
|
|
|
## Index
|
|
|
|
|
|
|
|
|
|
|
|
### Constructors
|
|
|
|
|
|
|
|
|
|
|
|
* [constructor](revolutejoint.md#constructor)
|
|
|
|
|
|
|
|
|
|
|
|
### Properties
|
|
|
|
|
|
|
|
|
|
|
|
* [TYPE](revolutejoint.md#static-type)
|
|
|
|
|
|
|
|
|
|
|
|
### Methods
|
|
|
|
|
|
|
|
|
|
|
|
* [enableLimit](revolutejoint.md#enablelimit)
|
|
|
|
|
|
* [enableMotor](revolutejoint.md#enablemotor)
|
2021-04-16 17:10:15 +02:00
|
|
|
|
* [getAnchorA](revolutejoint.md#getanchora)
|
|
|
|
|
|
* [getAnchorB](revolutejoint.md#getanchorb)
|
|
|
|
|
|
* [getBodyA](revolutejoint.md#getbodya)
|
|
|
|
|
|
* [getBodyB](revolutejoint.md#getbodyb)
|
|
|
|
|
|
* [getCollideConnected](revolutejoint.md#getcollideconnected)
|
2020-07-28 20:21:55 -07:00
|
|
|
|
* [getJointAngle](revolutejoint.md#getjointangle)
|
|
|
|
|
|
* [getJointSpeed](revolutejoint.md#getjointspeed)
|
|
|
|
|
|
* [getLocalAnchorA](revolutejoint.md#getlocalanchora)
|
|
|
|
|
|
* [getLocalAnchorB](revolutejoint.md#getlocalanchorb)
|
|
|
|
|
|
* [getLowerLimit](revolutejoint.md#getlowerlimit)
|
|
|
|
|
|
* [getMaxMotorTorque](revolutejoint.md#getmaxmotortorque)
|
|
|
|
|
|
* [getMotorSpeed](revolutejoint.md#getmotorspeed)
|
|
|
|
|
|
* [getMotorTorque](revolutejoint.md#getmotortorque)
|
2021-04-16 17:10:15 +02:00
|
|
|
|
* [getNext](revolutejoint.md#getnext)
|
|
|
|
|
|
* [getReactionForce](revolutejoint.md#getreactionforce)
|
|
|
|
|
|
* [getReactionTorque](revolutejoint.md#getreactiontorque)
|
2020-07-28 20:21:55 -07:00
|
|
|
|
* [getReferenceAngle](revolutejoint.md#getreferenceangle)
|
2021-04-16 17:10:15 +02:00
|
|
|
|
* [getType](revolutejoint.md#gettype)
|
2020-07-28 20:21:55 -07:00
|
|
|
|
* [getUpperLimit](revolutejoint.md#getupperlimit)
|
2021-04-16 17:10:15 +02:00
|
|
|
|
* [getUserData](revolutejoint.md#getuserdata)
|
|
|
|
|
|
* [initVelocityConstraints](revolutejoint.md#initvelocityconstraints)
|
|
|
|
|
|
* [isActive](revolutejoint.md#isactive)
|
2020-07-28 20:21:55 -07:00
|
|
|
|
* [isLimitEnabled](revolutejoint.md#islimitenabled)
|
|
|
|
|
|
* [isMotorEnabled](revolutejoint.md#ismotorenabled)
|
|
|
|
|
|
* [setLimits](revolutejoint.md#setlimits)
|
|
|
|
|
|
* [setMaxMotorTorque](revolutejoint.md#setmaxmotortorque)
|
|
|
|
|
|
* [setMotorSpeed](revolutejoint.md#setmotorspeed)
|
2021-04-16 17:10:15 +02:00
|
|
|
|
* [setUserData](revolutejoint.md#setuserdata)
|
|
|
|
|
|
* [shiftOrigin](revolutejoint.md#shiftorigin)
|
|
|
|
|
|
* [solvePositionConstraints](revolutejoint.md#solvepositionconstraints)
|
|
|
|
|
|
* [solveVelocityConstraints](revolutejoint.md#solvevelocityconstraints)
|
2020-07-28 20:21:55 -07:00
|
|
|
|
|
|
|
|
|
|
## Constructors
|
|
|
|
|
|
|
|
|
|
|
|
### constructor
|
|
|
|
|
|
|
|
|
|
|
|
\+ **new RevoluteJoint**(`def`: [RevoluteJointDef](../interfaces/revolutejointdef.md)): *[RevoluteJoint](revolutejoint.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/RevoluteJoint.ts:156](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/joint/RevoluteJoint.ts#L156)*
|
2020-07-28 20:21:55 -07:00
|
|
|
|
|
|
|
|
|
|
**Parameters:**
|
|
|
|
|
|
|
|
|
|
|
|
Name | Type |
|
|
|
|
|
|
------ | ------ |
|
|
|
|
|
|
`def` | [RevoluteJointDef](../interfaces/revolutejointdef.md) |
|
|
|
|
|
|
|
|
|
|
|
|
**Returns:** *[RevoluteJoint](revolutejoint.md)*
|
|
|
|
|
|
|
|
|
|
|
|
\+ **new RevoluteJoint**(`def`: [RevoluteJointOpt](../interfaces/revolutejointopt.md), `bodyA`: [Body](body.md), `bodyB`: [Body](body.md), `anchor`: [Vec2](vec2.md)): *[RevoluteJoint](revolutejoint.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/RevoluteJoint.ts:158](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/joint/RevoluteJoint.ts#L158)*
|
2020-07-28 20:21:55 -07:00
|
|
|
|
|
|
|
|
|
|
**Parameters:**
|
|
|
|
|
|
|
|
|
|
|
|
Name | Type |
|
|
|
|
|
|
------ | ------ |
|
|
|
|
|
|
`def` | [RevoluteJointOpt](../interfaces/revolutejointopt.md) |
|
|
|
|
|
|
`bodyA` | [Body](body.md) |
|
|
|
|
|
|
`bodyB` | [Body](body.md) |
|
|
|
|
|
|
`anchor` | [Vec2](vec2.md) |
|
|
|
|
|
|
|
|
|
|
|
|
**Returns:** *[RevoluteJoint](revolutejoint.md)*
|
|
|
|
|
|
|
|
|
|
|
|
## Properties
|
|
|
|
|
|
|
|
|
|
|
|
### `Static` TYPE
|
|
|
|
|
|
|
2021-04-16 17:10:15 +02:00
|
|
|
|
▪ **TYPE**: *"revolute-joint"* = 'revolute-joint' as 'revolute-joint'
|
|
|
|
|
|
|
2021-05-11 18:30:36 -07:00
|
|
|
|
*Defined in [src/dynamics/joint/RevoluteJoint.ts:131](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/joint/RevoluteJoint.ts#L131)*
|
2020-07-28 20:21:55 -07:00
|
|
|
|
|
|
|
|
|
|
## Methods
|
|
|
|
|
|
|
|
|
|
|
|
### enableLimit
|
|
|
|
|
|
|
2021-05-11 18:30:36 -07:00
|
|
|
|
▸ **enableLimit**(`flag`: boolean): *void*
|
2021-04-16 17:10:15 +02:00
|
|
|
|
|
2021-05-11 18:30:36 -07:00
|
|
|
|
*Defined in [src/dynamics/joint/RevoluteJoint.ts:368](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/joint/RevoluteJoint.ts#L368)*
|
2020-07-28 20:21:55 -07:00
|
|
|
|
|
2021-04-16 17:10:15 +02:00
|
|
|
|
Enable/disable the joint limit.
|
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*
|
|
|
|
|
|
|
|
|
|
|
|
___
|
|
|
|
|
|
|
|
|
|
|
|
### 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/RevoluteJoint.ts:316](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/joint/RevoluteJoint.ts#L316)*
|
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/RevoluteJoint.ts:409](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/joint/RevoluteJoint.ts#L409)*
|
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/RevoluteJoint.ts:416](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/joint/RevoluteJoint.ts#L416)*
|
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
|
|
|
|
### getJointAngle
|
|
|
|
|
|
|
|
|
|
|
|
▸ **getJointAngle**(): *number*
|
|
|
|
|
|
|
2021-05-11 18:30:36 -07:00
|
|
|
|
*Defined in [src/dynamics/joint/RevoluteJoint.ts:291](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/joint/RevoluteJoint.ts#L291)*
|
2021-04-16 17:10:15 +02:00
|
|
|
|
|
|
|
|
|
|
Get the current joint angle in radians.
|
2020-07-28 20:21:55 -07:00
|
|
|
|
|
|
|
|
|
|
**Returns:** *number*
|
|
|
|
|
|
|
|
|
|
|
|
___
|
|
|
|
|
|
|
|
|
|
|
|
### getJointSpeed
|
|
|
|
|
|
|
|
|
|
|
|
▸ **getJointSpeed**(): *number*
|
|
|
|
|
|
|
2021-05-11 18:30:36 -07:00
|
|
|
|
*Defined in [src/dynamics/joint/RevoluteJoint.ts:300](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/joint/RevoluteJoint.ts#L300)*
|
2021-04-16 17:10:15 +02:00
|
|
|
|
|
|
|
|
|
|
Get the current joint angle speed in radians per second.
|
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/RevoluteJoint.ts:270](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/joint/RevoluteJoint.ts#L270)*
|
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/RevoluteJoint.ts:277](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/joint/RevoluteJoint.ts#L277)*
|
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
|
|
|
|
|
|
|
|
|
|
___
|
|
|
|
|
|
|
|
|
|
|
|
### getLowerLimit
|
|
|
|
|
|
|
|
|
|
|
|
▸ **getLowerLimit**(): *number*
|
|
|
|
|
|
|
2021-05-11 18:30:36 -07:00
|
|
|
|
*Defined in [src/dynamics/joint/RevoluteJoint.ts:380](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/joint/RevoluteJoint.ts#L380)*
|
2021-04-16 17:10:15 +02:00
|
|
|
|
|
|
|
|
|
|
Get the lower joint limit in radians.
|
2020-07-28 20:21:55 -07:00
|
|
|
|
|
|
|
|
|
|
**Returns:** *number*
|
|
|
|
|
|
|
|
|
|
|
|
___
|
|
|
|
|
|
|
|
|
|
|
|
### getMaxMotorTorque
|
|
|
|
|
|
|
|
|
|
|
|
▸ **getMaxMotorTorque**(): *number*
|
|
|
|
|
|
|
2021-05-11 18:30:36 -07:00
|
|
|
|
*Defined in [src/dynamics/joint/RevoluteJoint.ts:354](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/joint/RevoluteJoint.ts#L354)*
|
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/RevoluteJoint.ts:341](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/joint/RevoluteJoint.ts#L341)*
|
2021-04-16 17:10:15 +02:00
|
|
|
|
|
|
|
|
|
|
Get the motor speed 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/RevoluteJoint.ts:325](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/joint/RevoluteJoint.ts#L325)*
|
2021-04-16 17:10:15 +02:00
|
|
|
|
|
|
|
|
|
|
Get the current motor torque given the inverse time step. Unit is 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)*
|
2021-04-16 17:10:15 +02:00
|
|
|
|
|
2021-05-02 17:18:33 -07:00
|
|
|
|
*Overrides [Joint](joint.md).[getReactionForce](joint.md#abstract-getreactionforce)*
|
2020-07-28 20:21:55 -07:00
|
|
|
|
|
2021-05-11 18:30:36 -07:00
|
|
|
|
*Defined in [src/dynamics/joint/RevoluteJoint.ts:423](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/joint/RevoluteJoint.ts#L423)*
|
2021-04-16 17:10:15 +02:00
|
|
|
|
|
|
|
|
|
|
Get the reaction force given the inverse time step. Unit is N.
|
|
|
|
|
|
|
|
|
|
|
|
**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/RevoluteJoint.ts:431](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/joint/RevoluteJoint.ts#L431)*
|
2021-04-16 17:10:15 +02:00
|
|
|
|
|
|
|
|
|
|
Get the reaction torque due to the joint limit given the inverse time step.
|
|
|
|
|
|
Unit is 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*
|
|
|
|
|
|
|
|
|
|
|
|
___
|
|
|
|
|
|
|
|
|
|
|
|
### getReferenceAngle
|
|
|
|
|
|
|
|
|
|
|
|
▸ **getReferenceAngle**(): *number*
|
|
|
|
|
|
|
2021-05-11 18:30:36 -07:00
|
|
|
|
*Defined in [src/dynamics/joint/RevoluteJoint.ts:284](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/joint/RevoluteJoint.ts#L284)*
|
2021-04-16 17:10:15 +02:00
|
|
|
|
|
|
|
|
|
|
Get the reference angle.
|
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*
|
|
|
|
|
|
|
|
|
|
|
|
___
|
|
|
|
|
|
|
2020-07-28 20:21:55 -07:00
|
|
|
|
### getUpperLimit
|
|
|
|
|
|
|
|
|
|
|
|
▸ **getUpperLimit**(): *number*
|
|
|
|
|
|
|
2021-05-11 18:30:36 -07:00
|
|
|
|
*Defined in [src/dynamics/joint/RevoluteJoint.ts:387](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/joint/RevoluteJoint.ts#L387)*
|
2021-04-16 17:10:15 +02:00
|
|
|
|
|
|
|
|
|
|
Get the upper joint limit in radians.
|
2020-07-28 20:21:55 -07:00
|
|
|
|
|
|
|
|
|
|
**Returns:** *number*
|
|
|
|
|
|
|
|
|
|
|
|
___
|
|
|
|
|
|
|
2021-04-16 17:10:15 +02:00
|
|
|
|
### 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/RevoluteJoint.ts:435](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/joint/RevoluteJoint.ts#L435)*
|
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
|
|
|
|
### isLimitEnabled
|
|
|
|
|
|
|
|
|
|
|
|
▸ **isLimitEnabled**(): *boolean*
|
|
|
|
|
|
|
2021-05-11 18:30:36 -07:00
|
|
|
|
*Defined in [src/dynamics/joint/RevoluteJoint.ts:361](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/joint/RevoluteJoint.ts#L361)*
|
2021-04-16 17:10:15 +02:00
|
|
|
|
|
|
|
|
|
|
Is the joint limit enabled?
|
2020-07-28 20:21:55 -07:00
|
|
|
|
|
|
|
|
|
|
**Returns:** *boolean*
|
|
|
|
|
|
|
|
|
|
|
|
___
|
|
|
|
|
|
|
|
|
|
|
|
### isMotorEnabled
|
|
|
|
|
|
|
|
|
|
|
|
▸ **isMotorEnabled**(): *boolean*
|
|
|
|
|
|
|
2021-05-11 18:30:36 -07:00
|
|
|
|
*Defined in [src/dynamics/joint/RevoluteJoint.ts:309](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/joint/RevoluteJoint.ts#L309)*
|
2021-04-16 17:10:15 +02:00
|
|
|
|
|
|
|
|
|
|
Is the joint motor enabled?
|
2020-07-28 20:21:55 -07:00
|
|
|
|
|
|
|
|
|
|
**Returns:** *boolean*
|
|
|
|
|
|
|
|
|
|
|
|
___
|
|
|
|
|
|
|
|
|
|
|
|
### setLimits
|
|
|
|
|
|
|
2021-05-11 18:30:36 -07:00
|
|
|
|
▸ **setLimits**(`lower`: number, `upper`: number): *void*
|
2020-07-28 20:21:55 -07:00
|
|
|
|
|
2021-05-11 18:30:36 -07:00
|
|
|
|
*Defined in [src/dynamics/joint/RevoluteJoint.ts:394](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/joint/RevoluteJoint.ts#L394)*
|
2021-04-16 17:10:15 +02:00
|
|
|
|
|
|
|
|
|
|
Set the joint limits in radians.
|
2020-07-28 20:21:55 -07:00
|
|
|
|
|
|
|
|
|
|
**Parameters:**
|
|
|
|
|
|
|
|
|
|
|
|
Name | Type |
|
|
|
|
|
|
------ | ------ |
|
2021-05-11 18:30:36 -07:00
|
|
|
|
`lower` | number |
|
|
|
|
|
|
`upper` | number |
|
2020-07-28 20:21:55 -07:00
|
|
|
|
|
|
|
|
|
|
**Returns:** *void*
|
|
|
|
|
|
|
|
|
|
|
|
___
|
|
|
|
|
|
|
|
|
|
|
|
### setMaxMotorTorque
|
|
|
|
|
|
|
2021-05-11 18:30:36 -07:00
|
|
|
|
▸ **setMaxMotorTorque**(`torque`: number): *void*
|
2021-04-16 17:10:15 +02:00
|
|
|
|
|
2021-05-11 18:30:36 -07:00
|
|
|
|
*Defined in [src/dynamics/joint/RevoluteJoint.ts:348](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/joint/RevoluteJoint.ts#L348)*
|
2020-07-28 20:21:55 -07:00
|
|
|
|
|
2021-04-16 17:10:15 +02:00
|
|
|
|
Set the maximum motor torque, 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/RevoluteJoint.ts:332](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/joint/RevoluteJoint.ts#L332)*
|
2021-04-16 17:10:15 +02:00
|
|
|
|
|
|
|
|
|
|
Set the motor speed in radians per second.
|
|
|
|
|
|
|
|
|
|
|
|
**Parameters:**
|
|
|
|
|
|
|
|
|
|
|
|
Name | Type |
|
|
|
|
|
|
------ | ------ |
|
2021-05-11 18:30:36 -07:00
|
|
|
|
`speed` | number |
|
2021-04-16 17:10:15 +02:00
|
|
|
|
|
|
|
|
|
|
**Returns:** *void*
|
|
|
|
|
|
|
|
|
|
|
|
___
|
|
|
|
|
|
|
|
|
|
|
|
### 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
|
2020-07-28 20:21:55 -07:00
|
|
|
|
|
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.
|
2020-07-28 20:21:55 -07:00
|
|
|
|
|
|
|
|
|
|
**Parameters:**
|
|
|
|
|
|
|
|
|
|
|
|
Name | Type |
|
|
|
|
|
|
------ | ------ |
|
2021-05-02 17:18:33 -07:00
|
|
|
|
`newOrigin` | [Vec2](vec2.md) |
|
2020-07-28 20:21:55 -07:00
|
|
|
|
|
|
|
|
|
|
**Returns:** *void*
|
2021-04-16 17:10:15 +02:00
|
|
|
|
|
|
|
|
|
|
___
|
|
|
|
|
|
|
|
|
|
|
|
### 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/RevoluteJoint.ts:657](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/joint/RevoluteJoint.ts#L657)*
|
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/RevoluteJoint.ts:546](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/joint/RevoluteJoint.ts#L546)*
|
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*
|