Class: Phaser.Physics.Ninja.AABB
Constructor
new AABB(body, x, y, width, height)
Ninja Physics AABB constructor.
Note: This class could be massively optimised and reduced in size. I leave that challenge up to you.
Parameters
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. |
- Source code: physics/ninja/AABB.js ( Line 20)
Public Properties
- Source code: physics/ninja/AABB.js ( Line 86)
- Source code: physics/ninja/AABB.js ( Line 25)
- Source code: physics/ninja/AABB.js ( Line 64)
- Source code: physics/ninja/AABB.js ( Line 40)
- Source code: physics/ninja/AABB.js ( Line 35)
- Source code: physics/ninja/AABB.js ( Line 30)
- Source code: physics/ninja/AABB.js ( Line 81)
- Source code: physics/ninja/AABB.js ( Line 58)
- Source code: physics/ninja/AABB.js ( Line 46)
- Source code: physics/ninja/AABB.js ( Line 52)
aabbTileProjections : Object
All of the collision response handlers.
body
Properties:
Name | Type | Description |
---|---|---|
system |
Phaser.Physics.Ninja.Body | A reference to the body that owns this shape. |
[readonly] height : number
The height.
oldpos : Phaser.Point
The position of this object in the previous update.
pos : Phaser.Point
The position of this object.
system : Phaser.Physics.Ninja
A reference to the physics system.
velocity : Phaser.Point
The velocity of this object.
[readonly] width : number
The width.
[readonly] xw : number
Half the width.
[readonly] yw
Properties:
Name | Type | Description |
---|---|---|
xw |
number | Half the height. |
Public Methods
- Source code: physics/ninja/AABB.js ( Line 336)
- Source code: physics/ninja/AABB.js ( Line 408)
- Source code: physics/ninja/AABB.js ( Line 295)
- Source code: physics/ninja/AABB.js ( Line 993)
- Source code: physics/ninja/AABB.js ( Line 108)
- Source code: physics/ninja/AABB.js ( Line 702)
- Source code: physics/ninja/AABB.js ( Line 622)
- Source code: physics/ninja/AABB.js ( Line 569)
- Source code: physics/ninja/AABB.js ( Line 834)
- Source code: physics/ninja/AABB.js ( Line 755)
- Source code: physics/ninja/AABB.js ( Line 935)
- Source code: physics/ninja/AABB.js ( Line 885)
- Source code: physics/ninja/AABB.js ( Line 491)
- Source code: physics/ninja/AABB.js ( Line 510)
- Source code: physics/ninja/AABB.js ( Line 1003)
- Source code: physics/ninja/AABB.js ( Line 128)
- Source code: physics/ninja/AABB.js ( Line 248)
- Source code: physics/ninja/AABB.js ( Line 202)
- Source code: physics/ninja/AABB.js ( Line 467)
- Source code: physics/ninja/AABB.js ( Line 216)
collideAABBVsAABB(aabb)
Collides this AABB against a AABB.
Parameters
Name | Type | Description |
---|---|---|
aabb |
Phaser.Physics.Ninja.AABB | The AABB to collide against. |
collideAABBVsTile(tile)
Collides this AABB against a Tile.
Parameters
Name | Type | Description |
---|---|---|
tile |
Phaser.Physics.Ninja.Tile | The Tile to collide against. |
collideWorldBounds()
Collides this AABB against the world bounds.
destroy()
Destroys this AABB's reference to Body and System
integrate()
Updates this AABBs position.
projAABB_22DegB(x, y, obj, t) → {number}
Resolves 22 Degree tile collision.
Parameters
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. |
Returns
The result of the collision.
projAABB_22DegS(x, y, obj, t) → {number}
Resolves 22 Degree tile collision.
Parameters
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. |
Returns
The result of the collision.
projAABB_45Deg(x, y, obj, t) → {number}
Resolves 45 Degree tile collision.
Parameters
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. |
Returns
The result of the collision.
projAABB_67DegB(x, y, obj, t) → {number}
Resolves 67 Degree tile collision.
Parameters
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. |
Returns
The result of the collision.
projAABB_67DegS(x, y, obj, t) → {number}
Resolves 67 Degree tile collision.
Parameters
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. |
Returns
The result of the collision.
projAABB_Concave(x, y, obj, t) → {number}
Resolves Concave tile collision.
Parameters
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. |
Returns
The result of the collision.
projAABB_Convex(x, y, obj, t) → {number}
Resolves Convex tile collision.
Parameters
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. |
Returns
The result of the collision.
projAABB_Full(x, y, obj, t) → {number}
Resolves Full tile collision.
Parameters
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. |
Returns
The result of the collision.
projAABB_Half(x, y, obj, t) → {number}
Resolves Half tile collision.
Parameters
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. |
Returns
The result of the collision.
render(context, xOffset, yOffset, color, filled)
Render this AABB for debugging purposes.
Parameters
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). |
reportCollision(px, py, dx, dy)
Process a collision partner-agnostic collision response and apply the resulting forces.
Parameters
Name | Type | Description |
---|---|---|
px |
number | The tangent velocity |
py |
number | The tangent velocity |
dx |
number | Collision normal |
dy |
number | Collision normal |
reportCollisionVsBody(px, py, dx, dy, obj)
Process a body collision and apply the resulting forces. Still very much WIP and doesn't work fully. Feel free to fix!
Parameters
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 |
reportCollisionVsWorld(px, py, dx, dy)
Process a world collision and apply the resulting forces.
Parameters
Name | Type | Description |
---|---|---|
px |
number | The tangent velocity |
py |
number | The tangent velocity |
dx |
number | Collision normal |
dy |
number | Collision normal |
resolveTile(x, y, body, tile) → {boolean}
Resolves tile collision.
Parameters
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. |
Returns
True if the collision was processed, otherwise false.
reverse()
© 2016 Richard Davey, Photon Storm Ltd.
Licensed under the MIT License.
http://phaser.io/docs/2.6.2/Phaser.Physics.Ninja.AABB.html