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 - physics/ninja/AABB.js, line 20
Members
-
aabbTileProjections :object
-
All of the collision response handlers.
- Source - physics/ninja/AABB.js, line 86
-
body
-
- Source - physics/ninja/AABB.js, line 25
Properties:
Name Type Description systemPhaser.Physics.Ninja.Body A reference to the body that owns this shape.
-
<readonly> height :number
-
The height.
- Source - physics/ninja/AABB.js, line 64
-
oldpos :Phaser.Point
-
The position of this object in the previous update.
- Source - physics/ninja/AABB.js, line 40
-
pos :Phaser.Point
-
The position of this object.
- Source - physics/ninja/AABB.js, line 35
-
system :Phaser.Physics.Ninja
-
A reference to the physics system.
- Source - physics/ninja/AABB.js, line 30
-
velocity :Phaser.Point
-
The velocity of this object.
- Source - physics/ninja/AABB.js, line 81
-
<readonly> width :number
-
The width.
- Source - physics/ninja/AABB.js, line 58
-
<readonly> xw :number
-
Half the width.
- Source - physics/ninja/AABB.js, line 46
-
<readonly> yw
-
- Source - physics/ninja/AABB.js, line 52
Properties:
Name Type Description xwnumber Half the height.
Methods
-
collideAABBVsAABB(aabb)
-
Collides this AABB against a AABB.
Parameters:
Name Type Description aabbPhaser.Physics.Ninja.AABB The AABB to collide against.
- Source - physics/ninja/AABB.js, line 333
-
collideAABBVsTile(tile)
-
Collides this AABB against a Tile.
Parameters:
Name Type Description tilePhaser.Physics.Ninja.Tile The Tile to collide against.
- Source - physics/ninja/AABB.js, line 405
-
collideWorldBounds()
-
Collides this AABB against the world bounds.
- Source - physics/ninja/AABB.js, line 292
-
destroy()
-
Destroys this AABB's reference to Body and System
- Source - physics/ninja/AABB.js, line 990
-
integrate()
-
Updates this AABBs position.
- Source - physics/ninja/AABB.js, line 108
-
projAABB_22DegB(x, y, obj, t) → {number}
-
Resolves 22 Degree tile collision.
Parameters:
Name Type Description xnumber Penetration depth on the x axis.
ynumber Penetration depth on the y axis.
objPhaser.Physics.Ninja.AABB The AABB involved in the collision.
tPhaser.Physics.Ninja.Tile The Tile involved in the collision.
Returns:
number -The result of the collision.
- Source - physics/ninja/AABB.js, line 699
-
projAABB_22DegS(x, y, obj, t) → {number}
-
Resolves 22 Degree tile collision.
Parameters:
Name Type Description xnumber Penetration depth on the x axis.
ynumber Penetration depth on the y axis.
objPhaser.Physics.Ninja.AABB The AABB involved in the collision.
tPhaser.Physics.Ninja.Tile The Tile involved in the collision.
Returns:
number -The result of the collision.
- Source - physics/ninja/AABB.js, line 619
-
projAABB_45Deg(x, y, obj, t) → {number}
-
Resolves 45 Degree tile collision.
Parameters:
Name Type Description xnumber Penetration depth on the x axis.
ynumber Penetration depth on the y axis.
objPhaser.Physics.Ninja.AABB The AABB involved in the collision.
tPhaser.Physics.Ninja.Tile The Tile involved in the collision.
Returns:
number -The result of the collision.
- Source - physics/ninja/AABB.js, line 566
-
projAABB_67DegB(x, y, obj, t) → {number}
-
Resolves 67 Degree tile collision.
Parameters:
Name Type Description xnumber Penetration depth on the x axis.
ynumber Penetration depth on the y axis.
objPhaser.Physics.Ninja.AABB The AABB involved in the collision.
tPhaser.Physics.Ninja.Tile The Tile involved in the collision.
Returns:
number -The result of the collision.
- Source - physics/ninja/AABB.js, line 831
-
projAABB_67DegS(x, y, obj, t) → {number}
-
Resolves 67 Degree tile collision.
Parameters:
Name Type Description xnumber Penetration depth on the x axis.
ynumber Penetration depth on the y axis.
objPhaser.Physics.Ninja.AABB The AABB involved in the collision.
tPhaser.Physics.Ninja.Tile The Tile involved in the collision.
Returns:
number -The result of the collision.
- Source - physics/ninja/AABB.js, line 752
-
projAABB_Concave(x, y, obj, t) → {number}
-
Resolves Concave tile collision.
Parameters:
Name Type Description xnumber Penetration depth on the x axis.
ynumber Penetration depth on the y axis.
objPhaser.Physics.Ninja.AABB The AABB involved in the collision.
tPhaser.Physics.Ninja.Tile The Tile involved in the collision.
Returns:
number -The result of the collision.
- Source - physics/ninja/AABB.js, line 932
-
projAABB_Convex(x, y, obj, t) → {number}
-
Resolves Convex tile collision.
Parameters:
Name Type Description xnumber Penetration depth on the x axis.
ynumber Penetration depth on the y axis.
objPhaser.Physics.Ninja.AABB The AABB involved in the collision.
tPhaser.Physics.Ninja.Tile The Tile involved in the collision.
Returns:
number -The result of the collision.
- Source - physics/ninja/AABB.js, line 882
-
projAABB_Full(x, y, obj, t) → {number}
-
Resolves Full tile collision.
Parameters:
Name Type Description xnumber Penetration depth on the x axis.
ynumber Penetration depth on the y axis.
objPhaser.Physics.Ninja.AABB The AABB involved in the collision.
tPhaser.Physics.Ninja.Tile The Tile involved in the collision.
Returns:
number -The result of the collision.
- Source - physics/ninja/AABB.js, line 488
-
projAABB_Half(x, y, obj, t) → {number}
-
Resolves Half tile collision.
Parameters:
Name Type Description xnumber Penetration depth on the x axis.
ynumber Penetration depth on the y axis.
objPhaser.Physics.Ninja.AABB The AABB involved in the collision.
tPhaser.Physics.Ninja.Tile The Tile involved in the collision.
Returns:
number -The result of the collision.
- Source - physics/ninja/AABB.js, line 507
-
render(context, xOffset, yOffset, color, filled)
-
Render this AABB for debugging purposes.
Parameters:
Name Type Description contextobject The context to render to.
xOffsetnumber X offset from AABB's position to render at.
yOffsetnumber Y offset from AABB's position to render at.
colorstring color of the debug shape to be rendered. (format is css color string).
filledboolean Render the shape as solid (true) or hollow (false).
- Source - physics/ninja/AABB.js, line 1000
-
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 pxnumber The tangent velocity
pynumber The tangent velocity
dxnumber Collision normal
dynumber Collision normal
objnumber Object this AABB collided with
- Source - physics/ninja/AABB.js, line 245
-
reportCollisionVsWorld(px, py, dx, dy)
-
Process a world collision and apply the resulting forces.
Parameters:
Name Type Description pxnumber The tangent velocity
pynumber The tangent velocity
dxnumber Collision normal
dynumber Collision normal
- Source - physics/ninja/AABB.js, line 202
-
resolveTile(x, y, body, tile) → {boolean}
-
Resolves tile collision.
Parameters:
Name Type Description xnumber Penetration depth on the x axis.
ynumber Penetration depth on the y axis.
bodyPhaser.Physics.Ninja.AABB The AABB involved in the collision.
tilePhaser.Physics.Ninja.Tile The Tile involved in the collision.
Returns:
boolean -True if the collision was processed, otherwise false.
- Source - physics/ninja/AABB.js, line 464
