Class: Camera3DPlugin

Camera3DPlugin

The Camera 3D Plugin adds a new Camera type to Phaser that allows for movement and rendering in 3D space. It displays a special type of Sprite called a Sprite3D that is a billboard sprite, with a z-axis allowing for perspective depth.

This is an external plugin which you can include in your game by preloading it:

this.load.scenePlugin({
  key: 'Camera3DPlugin',
  url: 'plugins/camera3d.min.js',
  sceneKey: 'cameras3d'
});

Once loaded you can create a 3D Camera using the camera3d property of a Scene:

var camera = this.cameras3d.add(85).setZ(500).setPixelScale(128);

See the examples for more information.


new Camera3DPlugin(scene, pluginManager)

Parameters:
Name Type Description
scene Phaser.Scene

The Scene to which this plugin is being installed.

pluginManager Phaser.Plugins.PluginManager

A reference to the Phaser Plugin Manager.

Source: plugins/camera3d/src/Camera3DPlugin.js (Line 16)

Members


cameras :Array.<Phaser.Cameras.Sprite3D.Camera>

An Array of the Camera objects being managed by this Camera Manager.

Type:
Since: 3.0.0
Source: plugins/camera3d/src/Camera3DPlugin.js (Line 54)

Methods


add( [fieldOfView] [, width] [, height])

[description]

Parameters:
Name Type Argument Default Description
fieldOfView number <optional>
80

[description]

width number <optional>

[description]

height number <optional>

[description]

Since: 3.0.0
Source: plugins/camera3d/src/Camera3DPlugin.js (Line 155)
Returns:

[description]

Type
Phaser.Cameras.Sprite3D.PerspectiveCamera

addOrthographicCamera(width, height)

[description]

Parameters:
Name Type Description
width number

[description]

height number

[description]

Since: 3.0.0
Source: plugins/camera3d/src/Camera3DPlugin.js (Line 172)
Returns:

[description]

Type
Phaser.Cameras.Sprite3D.OrthographicCamera

addPerspectiveCamera( [fieldOfView] [, width] [, height])

[description]

Parameters:
Name Type Argument Default Description
fieldOfView number <optional>
80

[description]

width number <optional>

[description]

height number <optional>

[description]

Since: 3.0.0
Source: plugins/camera3d/src/Camera3DPlugin.js (Line 197)
Returns:

[description]

Type
Phaser.Cameras.Sprite3D.PerspectiveCamera

getCamera(name)

[description]

Parameters:
Name Type Description
name string

[description]

Since: 3.0.0
Source: plugins/camera3d/src/Camera3DPlugin.js (Line 224)
Returns:

[description]

Type
Phaser.Cameras.Sprite3D.OrthographicCamera | Phaser.Cameras.Sprite3D.PerspectiveCamera

removeAll()

[description]

Since: 3.0.0
Source: plugins/camera3d/src/Camera3DPlugin.js (Line 265)
Returns:

[description]

Type
Phaser.Cameras.Sprite3D.OrthographicCamera | Phaser.Cameras.Sprite3D.PerspectiveCamera

removeCamera(camera)

[description]

Parameters:
Name Type Description
camera Phaser.Cameras.Sprite3D.OrthographicCamera | Phaser.Cameras.Sprite3D.PerspectiveCamera

[description]

Since: 3.0.0
Source: plugins/camera3d/src/Camera3DPlugin.js (Line 247)

update(timestep, delta)

[description]

Parameters:
Name Type Description
timestep number

[description]

delta number

[description]

Since: 3.0.0
Source: plugins/camera3d/src/Camera3DPlugin.js (Line 285)