Class: Projector

.Isometric. Projector

Creates a new Isometric Projector object, which has helpers for projecting x, y and z coordinates into axonometric x and y equivalents.

new Projector(game, projectionAngle) → {Phaser.Plugin.Isometric.Cube}

Parameters:
Name Type Description
game Phaser.Game

The current game object.

projectionAngle number

The angle of the axonometric projection in radians. Defaults to approx. 0.4636476 (Math.atan(0.5) which is suitable for 2:1 pixel art dimetric)

Source:
Returns:

This Cube object.

Type
Phaser.Plugin.Isometric.Cube

Members

anchor

Properties:
Name Type Description
anchor Phaser.Point

The x and y offset multipliers as a ratio of the game world size.

Source:

game

Properties:
Name Type Description
game Phaser.Game

The current game object.

Source:

projectionAngle

Properties:
Name Type Description
projectionAngle number

The angle of axonometric projection.

Source:

projectionAngle

Properties:
Name Type Description
projectionAngle number

The angle of projection in radians.

Source:

Methods

project(point3, out) → {Phaser.Point}

Use axonometric projection to transform a 3D Point3 coordinate to a 2D Point coordinate. If given the coordinates will be set into the object, otherwise a brand new Point object will be created and returned.

Parameters:
Name Type Description
point3 Phaser.Plugin.Isometric.Point3

The Point3 to project from.

out Phaser.Point

The Point to project to.

Source:
Returns:

The transformed Point.

Type
Phaser.Point

projectXY(point3, out) → {Phaser.Point}

Use axonometric projection to transform a 3D Point3 coordinate to a 2D Point coordinate, ignoring the z-axis. If given the coordinates will be set into the object, otherwise a brand new Point object will be created and returned.

Parameters:
Name Type Description
point3 Phaser.Plugin.Isometric.Point3

The Point3 to project from.

out Phaser.Point

The Point to project to.

Source:
Returns:

The transformed Point.

Type
Phaser.Point

simpleSort(group)

Perform a simple depth sort on all IsoSprites in the passed group. This function is fast and will accurately sort items on a single z-plane, but breaks down when items are above/below one another in certain configurations.

Parameters:
Name Type Description
group Phaser.Group

A group of IsoSprites to sort.

Source:

topologicalSort(group, padding, prop)

Perform a volume-based topological sort on all IsoSprites in the passed group or array. Will use the body if available, otherwise it will use an automatically generated bounding cube. If a group is passed, Phaser.Group#sort is automatically called on the specified property. Routine adapted from this tutorial: http://mazebert.com/2013/04/18/isometric-depth-sorting/

Parameters:
Name Type Argument Description
group Phaser.Group | array

A group or array of IsoSprites to sort.

padding number <optional>

The amount of extra tolerance in the depth sorting; larger values reduce flickering when objects collide, but also introduce inaccuracy when objects are close. Defaults to 1.5.

prop string <optional>

The property to store the depth information on. If not specified, it will default to 'isoDepth'.

Source:

unproject(point, out, z) → {Phaser.Plugin.Isometric.Point3}

Use reverse axonometric projection to transform a 2D Point coordinate to a 3D Point3 coordinate. If given the coordinates will be set into the object, otherwise a brand new Point3 object will be created and returned.

Parameters:
Name Type Argument Description
point Phaser.Plugin.Isometric.Point

The Point to project from.

out Phaser.Plugin.Isometric.Point3

The Point3 to project to.

z number <optional>

Specified z-plane to project to.

Source:
Returns:

The transformed Point3.

Type
Phaser.Plugin.Isometric.Point3