217 lines
4.4 KiB
Markdown
Raw Permalink Normal View History

2020-07-28 20:21:55 -07:00
[Planck.js API Doc](../README.md) › [Globals](../globals.md) › [Solver](solver.md)
# Class: Solver
2021-04-16 17:10:15 +02:00
Finds and solves islands. An island is a connected subset of the world.
2020-07-28 20:21:55 -07:00
## Hierarchy
* **Solver**
2021-04-16 17:10:15 +02:00
## Index
### Constructors
* [constructor](solver.md#constructor)
### Properties
* [m_bodies](solver.md#m_bodies)
* [m_contacts](solver.md#m_contacts)
* [m_joints](solver.md#m_joints)
* [m_stack](solver.md#m_stack)
* [m_world](solver.md#m_world)
### Methods
* [addBody](solver.md#addbody)
* [addContact](solver.md#addcontact)
* [addJoint](solver.md#addjoint)
* [clear](solver.md#clear)
* [solveIsland](solver.md#solveisland)
* [solveIslandTOI](solver.md#solveislandtoi)
* [solveWorld](solver.md#solveworld)
* [solveWorldTOI](solver.md#solveworldtoi)
## Constructors
### constructor
2021-05-11 18:30:36 -07:00
\+ **new Solver**(`world`: [World](world.md)): *[Solver](solver.md)*
2021-04-16 17:10:15 +02:00
2021-05-11 18:30:36 -07:00
*Defined in [src/dynamics/Solver.ts:116](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/Solver.ts#L116)*
2021-04-16 17:10:15 +02:00
**Parameters:**
Name | Type |
------ | ------ |
2021-05-11 18:30:36 -07:00
`world` | [World](world.md) |
2021-04-16 17:10:15 +02:00
**Returns:** *[Solver](solver.md)*
## Properties
### m_bodies
• **m_bodies**: *[Body](body.md)[]*
2021-04-16 17:10:15 +02:00
2021-05-11 18:30:36 -07:00
*Defined in [src/dynamics/Solver.ts:114](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/Solver.ts#L114)*
2021-04-16 17:10:15 +02:00
___
### m_contacts
• **m_contacts**: *[Contact](contact.md)[]*
2021-04-16 17:10:15 +02:00
2021-05-11 18:30:36 -07:00
*Defined in [src/dynamics/Solver.ts:115](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/Solver.ts#L115)*
2021-04-16 17:10:15 +02:00
___
### m_joints
• **m_joints**: *[Joint](joint.md)[]*
2021-04-16 17:10:15 +02:00
2021-05-11 18:30:36 -07:00
*Defined in [src/dynamics/Solver.ts:116](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/Solver.ts#L116)*
2021-04-16 17:10:15 +02:00
___
### m_stack
• **m_stack**: *[Body](body.md)[]*
2021-04-16 17:10:15 +02:00
2021-05-11 18:30:36 -07:00
*Defined in [src/dynamics/Solver.ts:113](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/Solver.ts#L113)*
2021-04-16 17:10:15 +02:00
___
### m_world
• **m_world**: *[World](world.md)*
2021-04-16 17:10:15 +02:00
2021-05-11 18:30:36 -07:00
*Defined in [src/dynamics/Solver.ts:112](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/Solver.ts#L112)*
2021-04-16 17:10:15 +02:00
## Methods
### addBody
2021-05-11 18:30:36 -07:00
▸ **addBody**(`body`: [Body](body.md)): *void*
2021-04-16 17:10:15 +02:00
2021-05-11 18:30:36 -07:00
*Defined in [src/dynamics/Solver.ts:133](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/Solver.ts#L133)*
2021-04-16 17:10:15 +02:00
**Parameters:**
Name | Type |
------ | ------ |
2021-05-11 18:30:36 -07:00
`body` | [Body](body.md) |
2021-04-16 17:10:15 +02:00
**Returns:** *void*
___
### addContact
2021-05-11 18:30:36 -07:00
▸ **addContact**(`contact`: [Contact](contact.md)): *void*
2021-04-16 17:10:15 +02:00
2021-05-11 18:30:36 -07:00
*Defined in [src/dynamics/Solver.ts:143](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/Solver.ts#L143)*
2021-04-16 17:10:15 +02:00
**Parameters:**
Name | Type |
------ | ------ |
2021-05-11 18:30:36 -07:00
`contact` | [Contact](contact.md) |
2021-04-16 17:10:15 +02:00
**Returns:** *void*
___
### addJoint
2021-05-11 18:30:36 -07:00
▸ **addJoint**(`joint`: [Joint](joint.md)): *void*
2021-04-16 17:10:15 +02:00
2021-05-11 18:30:36 -07:00
*Defined in [src/dynamics/Solver.ts:148](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/Solver.ts#L148)*
2021-04-16 17:10:15 +02:00
**Parameters:**
Name | Type |
------ | ------ |
2021-05-11 18:30:36 -07:00
`joint` | [Joint](joint.md) |
2021-04-16 17:10:15 +02:00
**Returns:** *void*
___
### clear
▸ **clear**(): *void*
2021-05-11 18:30:36 -07:00
*Defined in [src/dynamics/Solver.ts:126](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/Solver.ts#L126)*
2021-04-16 17:10:15 +02:00
**Returns:** *void*
___
### solveIsland
▸ **solveIsland**(`step`: [TimeStep](timestep.md)): *void*
2021-04-16 17:10:15 +02:00
2021-05-11 18:30:36 -07:00
*Defined in [src/dynamics/Solver.ts:284](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/Solver.ts#L284)*
2021-04-16 17:10:15 +02:00
**Parameters:**
Name | Type |
------ | ------ |
`step` | [TimeStep](timestep.md) |
2021-04-16 17:10:15 +02:00
**Returns:** *void*
___
### solveIslandTOI
2021-05-11 18:30:36 -07:00
▸ **solveIslandTOI**(`subStep`: [TimeStep](timestep.md), `toiA`: [Body](body.md), `toiB`: [Body](body.md)): *void*
2021-04-16 17:10:15 +02:00
2021-05-11 18:30:36 -07:00
*Defined in [src/dynamics/Solver.ts:782](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/Solver.ts#L782)*
2021-04-16 17:10:15 +02:00
**Parameters:**
Name | Type |
------ | ------ |
`subStep` | [TimeStep](timestep.md) |
2021-05-11 18:30:36 -07:00
`toiA` | [Body](body.md) |
`toiB` | [Body](body.md) |
2021-04-16 17:10:15 +02:00
**Returns:** *void*
___
### solveWorld
▸ **solveWorld**(`step`: [TimeStep](timestep.md)): *void*
2021-04-16 17:10:15 +02:00
2021-05-11 18:30:36 -07:00
*Defined in [src/dynamics/Solver.ts:153](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/Solver.ts#L153)*
2021-04-16 17:10:15 +02:00
**Parameters:**
Name | Type |
------ | ------ |
`step` | [TimeStep](timestep.md) |
2021-04-16 17:10:15 +02:00
**Returns:** *void*
___
### solveWorldTOI
▸ **solveWorldTOI**(`step`: [TimeStep](timestep.md)): *void*
2021-04-16 17:10:15 +02:00
2021-05-11 18:30:36 -07:00
*Defined in [src/dynamics/Solver.ts:504](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/Solver.ts#L504)*
2021-04-16 17:10:15 +02:00
Find TOI contacts and solve them.
**Parameters:**
Name | Type |
------ | ------ |
`step` | [TimeStep](timestep.md) |
2021-04-16 17:10:15 +02:00
**Returns:** *void*