# Class: AABB

## Phaser.Physics.Ninja. AABB

Arcade Physics 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:
    - physics/ninja/AABB.js, line 21

### Members

#### aabbTileProjections

  ##### Properties:

  Name | Type | Description
  --- | --- | ---
  `aabbTileProjections` | object | All of the collision response handlers.

  Source:
    - physics/ninja/AABB.js, line 87

#### body

  ##### Properties:

  Name | Type | Description
  --- | --- | ---
  `system` | Phaser.Physics.Ninja.Body | A reference to the body that owns this shape.

  Source:
    - physics/ninja/AABB.js, line 26

#### <readonly> height

  ##### Properties:

  Name | Type | Description
  --- | --- | ---
  `height` | number | The height.

  Source:
    - physics/ninja/AABB.js, line 65

#### oldpos

  ##### Properties:

  Name | Type | Description
  --- | --- | ---
  `oldpos` | Phaser.Point | The position of this object in the previous update.

  Source:
    - physics/ninja/AABB.js, line 41

#### pos

  ##### Properties:

  Name | Type | Description
  --- | --- | ---
  `pos` | Phaser.Point | The position of this object.

  Source:
    - physics/ninja/AABB.js, line 36

#### system

  ##### Properties:

  Name | Type | Description
  --- | --- | ---
  `system` | Phaser.Physics.Ninja | A reference to the physics system.

  Source:
    - physics/ninja/AABB.js, line 31

#### velocity

  ##### Properties:

  Name | Type | Description
  --- | --- | ---
  `velocity` | Phaser.Point | The velocity of this object.

  Source:
    - physics/ninja/AABB.js, line 82

#### <readonly> width

  ##### Properties:

  Name | Type | Description
  --- | --- | ---
  `width` | number | The width.

  Source:
    - physics/ninja/AABB.js, line 59

#### <readonly> xw

  ##### Properties:

  Name | Type | Description
  --- | --- | ---
  `xw` | number | Half the width.

  Source:
    - physics/ninja/AABB.js, line 47

#### <readonly> yw

  ##### Properties:

  Name | Type | Description
  --- | --- | ---
  `xw` | number | Half the height.

  Source:
    - physics/ninja/AABB.js, line 53

### Methods

#### collideAABBVsAABB(aabb)

  Collides this AABB against a AABB.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `aabb` | Phaser.Physics.Ninja.AABB | The AABB to collide against.

  Source:
    - physics/ninja/AABB.js, line 341

#### collideAABBVsTile(tile)

  Collides this AABB against a Tile.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `tile` | Phaser.Physics.Ninja.Tile | The Tile to collide against.

  Source:
    - physics/ninja/AABB.js, line 413

#### collideWorldBounds()

  Collides this AABB against the world bounds.

  Source:
    - physics/ninja/AABB.js, line 300

#### destroy()

  Destroys this AABB's reference to Body and System

  Source:
    - physics/ninja/AABB.js, line 998

#### integrate()

  Updates this AABBs position.

  Source:
    - physics/ninja/AABB.js, line 109

#### 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.

  Source:
    - physics/ninja/AABB.js, line 707

  ##### Returns:

  The result of the collision.

  Type
    number

#### 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.

  Source:
    - physics/ninja/AABB.js, line 627

  ##### Returns:

  The result of the collision.

  Type
    number

#### 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.

  Source:
    - physics/ninja/AABB.js, line 574

  ##### Returns:

  The result of the collision.

  Type
    number

#### 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.

  Source:
    - physics/ninja/AABB.js, line 839

  ##### Returns:

  The result of the collision.

  Type
    number

#### 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.

  Source:
    - physics/ninja/AABB.js, line 760

  ##### Returns:

  The result of the collision.

  Type
    number

#### 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.

  Source:
    - physics/ninja/AABB.js, line 940

  ##### Returns:

  The result of the collision.

  Type
    number

#### 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.

  Source:
    - physics/ninja/AABB.js, line 890

  ##### Returns:

  The result of the collision.

  Type
    number

#### 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.

  Source:
    - physics/ninja/AABB.js, line 496

  ##### Returns:

  The result of the collision.

  Type
    number

#### 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.

  Source:
    - physics/ninja/AABB.js, line 515

  ##### Returns:

  The result of the collision.

  Type
    number

#### 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

  Source:
    - physics/ninja/AABB.js, line 233

#### reportCollisionVsWorld(px, py, dx, dy, obj)

  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
  `obj` | number | Object this AABB collided with

  Source:
    - physics/ninja/AABB.js, line 129

#### 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.

  Source:
    - physics/ninja/AABB.js, line 472

  ##### Returns:

  True if the collision was processed, otherwise false.

  Type
    boolean