2020-07-28 20:21:55 -07:00
|
|
|
|
[Planck.js API Doc](../README.md) › [Globals](../globals.md) › [GearJoint](gearjoint.md)
|
|
|
|
|
|
|
|
|
|
|
|
# Class: GearJoint
|
|
|
|
|
|
|
2021-04-16 17:10:15 +02:00
|
|
|
|
A gear joint is used to connect two joints together. Either joint can be a
|
|
|
|
|
|
revolute or prismatic joint. You specify a gear ratio to bind the motions
|
|
|
|
|
|
together: coordinate1 + ratio * coordinate2 = constant
|
|
|
|
|
|
|
|
|
|
|
|
The ratio can be negative or positive. If one joint is a revolute joint and
|
|
|
|
|
|
the other joint is a prismatic joint, then the ratio will have units of
|
|
|
|
|
|
length or units of 1/length. Warning: You have to manually destroy the gear
|
|
|
|
|
|
joint if joint1 or joint2 is destroyed.
|
|
|
|
|
|
|
|
|
|
|
|
This definition requires two existing revolute or prismatic joints (any
|
|
|
|
|
|
combination will work).
|
|
|
|
|
|
|
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
|
|
|
|
↳ **GearJoint**
|
|
|
|
|
|
|
|
|
|
|
|
## Index
|
|
|
|
|
|
|
|
|
|
|
|
### Constructors
|
|
|
|
|
|
|
|
|
|
|
|
* [constructor](gearjoint.md#constructor)
|
|
|
|
|
|
|
|
|
|
|
|
### Properties
|
|
|
|
|
|
|
|
|
|
|
|
* [TYPE](gearjoint.md#static-type)
|
|
|
|
|
|
|
|
|
|
|
|
### Methods
|
|
|
|
|
|
|
2021-04-16 17:10:15 +02:00
|
|
|
|
* [getAnchorA](gearjoint.md#getanchora)
|
|
|
|
|
|
* [getAnchorB](gearjoint.md#getanchorb)
|
|
|
|
|
|
* [getBodyA](gearjoint.md#getbodya)
|
|
|
|
|
|
* [getBodyB](gearjoint.md#getbodyb)
|
|
|
|
|
|
* [getCollideConnected](gearjoint.md#getcollideconnected)
|
2020-07-28 20:21:55 -07:00
|
|
|
|
* [getJoint1](gearjoint.md#getjoint1)
|
|
|
|
|
|
* [getJoint2](gearjoint.md#getjoint2)
|
2021-04-16 17:10:15 +02:00
|
|
|
|
* [getNext](gearjoint.md#getnext)
|
2020-07-28 20:21:55 -07:00
|
|
|
|
* [getRatio](gearjoint.md#getratio)
|
2021-04-16 17:10:15 +02:00
|
|
|
|
* [getReactionForce](gearjoint.md#getreactionforce)
|
|
|
|
|
|
* [getReactionTorque](gearjoint.md#getreactiontorque)
|
|
|
|
|
|
* [getType](gearjoint.md#gettype)
|
|
|
|
|
|
* [getUserData](gearjoint.md#getuserdata)
|
|
|
|
|
|
* [initVelocityConstraints](gearjoint.md#initvelocityconstraints)
|
|
|
|
|
|
* [isActive](gearjoint.md#isactive)
|
2020-07-28 20:21:55 -07:00
|
|
|
|
* [setRatio](gearjoint.md#setratio)
|
2021-04-16 17:10:15 +02:00
|
|
|
|
* [setUserData](gearjoint.md#setuserdata)
|
|
|
|
|
|
* [shiftOrigin](gearjoint.md#shiftorigin)
|
|
|
|
|
|
* [solvePositionConstraints](gearjoint.md#solvepositionconstraints)
|
|
|
|
|
|
* [solveVelocityConstraints](gearjoint.md#solvevelocityconstraints)
|
2020-07-28 20:21:55 -07:00
|
|
|
|
|
|
|
|
|
|
## Constructors
|
|
|
|
|
|
|
|
|
|
|
|
### constructor
|
|
|
|
|
|
|
|
|
|
|
|
\+ **new GearJoint**(`def`: [GearJointDef](../interfaces/gearjointdef.md)): *[GearJoint](gearjoint.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/GearJoint.ts:122](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/joint/GearJoint.ts#L122)*
|
2020-07-28 20:21:55 -07:00
|
|
|
|
|
|
|
|
|
|
**Parameters:**
|
|
|
|
|
|
|
|
|
|
|
|
Name | Type |
|
|
|
|
|
|
------ | ------ |
|
|
|
|
|
|
`def` | [GearJointDef](../interfaces/gearjointdef.md) |
|
|
|
|
|
|
|
|
|
|
|
|
**Returns:** *[GearJoint](gearjoint.md)*
|
|
|
|
|
|
|
|
|
|
|
|
\+ **new GearJoint**(`def`: [GearJointOpt](../interfaces/gearjointopt.md), `bodyA`: [Body](body.md), `bodyB`: [Body](body.md), `joint1`: [RevoluteJoint](revolutejoint.md) | [PrismaticJoint](prismaticjoint.md), `joint2`: [RevoluteJoint](revolutejoint.md) | [PrismaticJoint](prismaticjoint.md), `ratio?`: number): *[GearJoint](gearjoint.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/GearJoint.ts:124](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/joint/GearJoint.ts#L124)*
|
2020-07-28 20:21:55 -07:00
|
|
|
|
|
|
|
|
|
|
**Parameters:**
|
|
|
|
|
|
|
|
|
|
|
|
Name | Type |
|
|
|
|
|
|
------ | ------ |
|
|
|
|
|
|
`def` | [GearJointOpt](../interfaces/gearjointopt.md) |
|
|
|
|
|
|
`bodyA` | [Body](body.md) |
|
|
|
|
|
|
`bodyB` | [Body](body.md) |
|
|
|
|
|
|
`joint1` | [RevoluteJoint](revolutejoint.md) | [PrismaticJoint](prismaticjoint.md) |
|
|
|
|
|
|
`joint2` | [RevoluteJoint](revolutejoint.md) | [PrismaticJoint](prismaticjoint.md) |
|
|
|
|
|
|
`ratio?` | number |
|
|
|
|
|
|
|
|
|
|
|
|
**Returns:** *[GearJoint](gearjoint.md)*
|
|
|
|
|
|
|
|
|
|
|
|
## Properties
|
|
|
|
|
|
|
|
|
|
|
|
### `Static` TYPE
|
|
|
|
|
|
|
2021-04-16 17:10:15 +02:00
|
|
|
|
▪ **TYPE**: *"gear-joint"* = 'gear-joint' as 'gear-joint'
|
|
|
|
|
|
|
2021-05-11 18:30:36 -07:00
|
|
|
|
*Defined in [src/dynamics/joint/GearJoint.ts:82](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/joint/GearJoint.ts#L82)*
|
2020-07-28 20:21:55 -07:00
|
|
|
|
|
|
|
|
|
|
## Methods
|
|
|
|
|
|
|
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/GearJoint.ts:302](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/joint/GearJoint.ts#L302)*
|
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/GearJoint.ts:309](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/joint/GearJoint.ts#L309)*
|
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
|
|
|
|
### getJoint1
|
|
|
|
|
|
|
2021-05-11 18:30:36 -07:00
|
|
|
|
▸ **getJoint1**(): *[Joint](joint.md)*
|
2020-07-28 20:21:55 -07:00
|
|
|
|
|
2021-05-11 18:30:36 -07:00
|
|
|
|
*Defined in [src/dynamics/joint/GearJoint.ts:273](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/joint/GearJoint.ts#L273)*
|
2021-04-16 17:10:15 +02:00
|
|
|
|
|
|
|
|
|
|
Get the first joint.
|
2020-07-28 20:21:55 -07:00
|
|
|
|
|
2021-05-11 18:30:36 -07:00
|
|
|
|
**Returns:** *[Joint](joint.md)*
|
2020-07-28 20:21:55 -07:00
|
|
|
|
|
|
|
|
|
|
___
|
|
|
|
|
|
|
|
|
|
|
|
### getJoint2
|
|
|
|
|
|
|
2021-05-11 18:30:36 -07:00
|
|
|
|
▸ **getJoint2**(): *[Joint](joint.md)*
|
2020-07-28 20:21:55 -07:00
|
|
|
|
|
2021-05-11 18:30:36 -07:00
|
|
|
|
*Defined in [src/dynamics/joint/GearJoint.ts:280](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/joint/GearJoint.ts#L280)*
|
2021-04-16 17:10:15 +02:00
|
|
|
|
|
|
|
|
|
|
Get the second joint.
|
2020-07-28 20:21:55 -07:00
|
|
|
|
|
2021-05-11 18:30:36 -07:00
|
|
|
|
**Returns:** *[Joint](joint.md)*
|
2020-07-28 20:21:55 -07:00
|
|
|
|
|
|
|
|
|
|
___
|
|
|
|
|
|
|
2021-04-16 17:10:15 +02:00
|
|
|
|
### 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
|
|
|
|
|
|
|
|
|
|
___
|
|
|
|
|
|
|
2020-07-28 20:21:55 -07:00
|
|
|
|
### getRatio
|
|
|
|
|
|
|
|
|
|
|
|
▸ **getRatio**(): *number*
|
|
|
|
|
|
|
2021-05-11 18:30:36 -07:00
|
|
|
|
*Defined in [src/dynamics/joint/GearJoint.ts:295](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/joint/GearJoint.ts#L295)*
|
2021-04-16 17:10:15 +02:00
|
|
|
|
|
|
|
|
|
|
Get the gear ratio.
|
2020-07-28 20:21:55 -07:00
|
|
|
|
|
|
|
|
|
|
**Returns:** *number*
|
|
|
|
|
|
|
|
|
|
|
|
___
|
|
|
|
|
|
|
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)*
|
2021-04-16 17:10:15 +02:00
|
|
|
|
|
2021-05-11 18:30:36 -07:00
|
|
|
|
*Defined in [src/dynamics/joint/GearJoint.ts:316](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/joint/GearJoint.ts#L316)*
|
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/GearJoint.ts:323](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/joint/GearJoint.ts#L323)*
|
2021-04-16 17:10:15 +02:00
|
|
|
|
|
|
|
|
|
|
Get the reaction torque on bodyB 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*
|
|
|
|
|
|
|
|
|
|
|
|
___
|
|
|
|
|
|
|
|
|
|
|
|
### 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/GearJoint.ts:328](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/joint/GearJoint.ts#L328)*
|
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
|
|
|
|
### setRatio
|
|
|
|
|
|
|
2021-05-11 18:30:36 -07:00
|
|
|
|
▸ **setRatio**(`ratio`: number): *void*
|
2020-07-28 20:21:55 -07:00
|
|
|
|
|
2021-05-11 18:30:36 -07:00
|
|
|
|
*Defined in [src/dynamics/joint/GearJoint.ts:287](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/joint/GearJoint.ts#L287)*
|
2021-04-16 17:10:15 +02:00
|
|
|
|
|
|
|
|
|
|
Set the gear 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*
|
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/GearJoint.ts:465](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/joint/GearJoint.ts#L465)*
|
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/GearJoint.ts:425](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/joint/GearJoint.ts#L425)*
|
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*
|