Ninja Physics AABB constructor.
Note: This class could be massively optimised and reduced in size. I leave that challenge up to you.
Name | Type | Description |
---|---|---|
body | Phaser.Physics.Ninja.Body | The body that owns this shape. |
x | number | The x coordinate to create this shape at. |
y | number | The y coordinate to create this shape at. |
width | number | The width of this AABB. |
height | number | The height of this AABB. |
All of the collision response handlers.
Name | Type | Description |
---|---|---|
system | Phaser.Physics.Ninja.Body | A reference to the body that owns this shape. |
The height.
The position of this object in the previous update.
The position of this object.
A reference to the physics system.
The velocity of this object.
The width.
Half the width.
Name | Type | Description |
---|---|---|
xw | number | Half the height. |
Collides this AABB against a AABB.
Name | Type | Description |
---|---|---|
aabb | Phaser.Physics.Ninja.AABB | The AABB to collide against. |
Collides this AABB against a Tile.
Name | Type | Description |
---|---|---|
tile | Phaser.Physics.Ninja.Tile | The Tile to collide against. |
Collides this AABB against the world bounds.
Destroys this AABB's reference to Body and System
Updates this AABBs position.
Resolves 22 Degree tile collision.
Name | Type | Description |
---|---|---|
x | number | Penetration depth on the x axis. |
y | number | Penetration depth on the y axis. |
obj | Phaser.Physics.Ninja.AABB | The AABB involved in the collision. |
t | Phaser.Physics.Ninja.Tile | The Tile involved in the collision. |
The result of the collision.
Resolves 22 Degree tile collision.
Name | Type | Description |
---|---|---|
x | number | Penetration depth on the x axis. |
y | number | Penetration depth on the y axis. |
obj | Phaser.Physics.Ninja.AABB | The AABB involved in the collision. |
t | Phaser.Physics.Ninja.Tile | The Tile involved in the collision. |
The result of the collision.
Resolves 45 Degree tile collision.
Name | Type | Description |
---|---|---|
x | number | Penetration depth on the x axis. |
y | number | Penetration depth on the y axis. |
obj | Phaser.Physics.Ninja.AABB | The AABB involved in the collision. |
t | Phaser.Physics.Ninja.Tile | The Tile involved in the collision. |
The result of the collision.
Resolves 67 Degree tile collision.
Name | Type | Description |
---|---|---|
x | number | Penetration depth on the x axis. |
y | number | Penetration depth on the y axis. |
obj | Phaser.Physics.Ninja.AABB | The AABB involved in the collision. |
t | Phaser.Physics.Ninja.Tile | The Tile involved in the collision. |
The result of the collision.
Resolves 67 Degree tile collision.
Name | Type | Description |
---|---|---|
x | number | Penetration depth on the x axis. |
y | number | Penetration depth on the y axis. |
obj | Phaser.Physics.Ninja.AABB | The AABB involved in the collision. |
t | Phaser.Physics.Ninja.Tile | The Tile involved in the collision. |
The result of the collision.
Resolves Concave tile collision.
Name | Type | Description |
---|---|---|
x | number | Penetration depth on the x axis. |
y | number | Penetration depth on the y axis. |
obj | Phaser.Physics.Ninja.AABB | The AABB involved in the collision. |
t | Phaser.Physics.Ninja.Tile | The Tile involved in the collision. |
The result of the collision.
Resolves Convex tile collision.
Name | Type | Description |
---|---|---|
x | number | Penetration depth on the x axis. |
y | number | Penetration depth on the y axis. |
obj | Phaser.Physics.Ninja.AABB | The AABB involved in the collision. |
t | Phaser.Physics.Ninja.Tile | The Tile involved in the collision. |
The result of the collision.
Resolves Full tile collision.
Name | Type | Description |
---|---|---|
x | number | Penetration depth on the x axis. |
y | number | Penetration depth on the y axis. |
obj | Phaser.Physics.Ninja.AABB | The AABB involved in the collision. |
t | Phaser.Physics.Ninja.Tile | The Tile involved in the collision. |
The result of the collision.
Resolves Half tile collision.
Name | Type | Description |
---|---|---|
x | number | Penetration depth on the x axis. |
y | number | Penetration depth on the y axis. |
obj | Phaser.Physics.Ninja.AABB | The AABB involved in the collision. |
t | Phaser.Physics.Ninja.Tile | The Tile involved in the collision. |
The result of the collision.
Render this AABB for debugging purposes.
Name | Type | Description |
---|---|---|
context | object | The context to render to. |
xOffset | number | X offset from AABB's position to render at. |
yOffset | number | Y offset from AABB's position to render at. |
color | string | color of the debug shape to be rendered. (format is css color string). |
filled | boolean | Render the shape as solid (true) or hollow (false). |
Process a collision partner-agnostic collision response and apply the resulting forces.
Name | Type | Description |
---|---|---|
px | number | The tangent velocity |
py | number | The tangent velocity |
dx | number | Collision normal |
dy | number | Collision normal |
Process a body collision and apply the resulting forces. Still very much WIP and doesn't work fully. Feel free to fix!
Name | Type | Description |
---|---|---|
px | number | The tangent velocity |
py | number | The tangent velocity |
dx | number | Collision normal |
dy | number | Collision normal |
obj | number | Object this AABB collided with |
Process a world collision and apply the resulting forces.
Name | Type | Description |
---|---|---|
px | number | The tangent velocity |
py | number | The tangent velocity |
dx | number | Collision normal |
dy | number | Collision normal |
Resolves tile collision.
Name | Type | Description |
---|---|---|
x | number | Penetration depth on the x axis. |
y | number | Penetration depth on the y axis. |
body | Phaser.Physics.Ninja.AABB | The AABB involved in the collision. |
tile | Phaser.Physics.Ninja.Tile | The Tile involved in the collision. |
True if the collision was processed, otherwise false.
© 2016 Richard Davey, Photon Storm Ltd.
Licensed under the MIT License.
http://phaser.io/docs/2.6.2/Phaser.Physics.Ninja.AABB.html