Constructor
new Engine(World, options)
Name | Type | Description | ||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
World | World | World the physics engine should run on | ||||||||||||||||||||||||||||||||||||||||
options | Object | Physics options Properties
|
- Source
Methods
update(deltaopt)
Ticks the engine one frame
Name | Type | Attributes | Description |
---|---|---|---|
delta | number | <optional> | Engine tick duration, in seconds |
- Source
collides(bodyA, bodyB) → {boolean}
Checks if bodyA
and bodyB
are colliding
Name | Type | Description |
---|---|---|
bodyA | CollisionShape | 1st body to check |
bodyB | CollisionShape | 2nd body to check |
- Source
If the bodies are colliding
- Type:
- boolean
cleansePair(pair) → {boolean}
Deletes the collision pair
Name | Type | Description |
---|---|---|
pair | Object | Pair to delete |
- Source
If pair was successfully removed, meaning they are no longer colliding
- Type:
- boolean
solveVelocity()
Solves velocity constriants on current collision pairs Also clears collision pairs that are no longer valid (they haven't collided this frame)
- Source
preSolvePosition()
Prepares contacts for position solver
- Source
solvePosition()
Solves position intersections between bodies based on their collision pairs
- Source
postSolvePosition()
Cleans up after position solver
- Source