Skip to content

Commit ba4816c

Browse files
committed
Typo plus example
1 parent fc51f3a commit ba4816c

1 file changed

Lines changed: 47 additions & 1 deletion

File tree

plugins/camera3d/readme.md

Lines changed: 47 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ Then you can use it like usual.
2020

2121
## 2. Bundled Plugin
2222

23-
If you prefer you can configure Phaser to include it when it builds it's dist files.
23+
If you prefer you can configure Phaser to include it when it builds its dist files.
2424

2525
To do this you need to edit the webpack config files and change the following:
2626

@@ -36,6 +36,52 @@ to
3636

3737
Then rebuild Phaser via webpack. The plugin will now be included by default and can be called from your game code.
3838

39+
## Using the Plugin
40+
41+
Here is a basic example of using the plugin. You can find many more in the Phaser 3 Examples repo in the `cameras/3D Camera` folder.
42+
43+
```
44+
var config = {
45+
type: Phaser.AUTO,
46+
width: 800,
47+
height: 600,
48+
scene: {
49+
preload: preload,
50+
create: create,
51+
update: update
52+
}
53+
};
54+
55+
var camera;
56+
var transform;
57+
58+
var game = new Phaser.Game(config);
59+
60+
function preload ()
61+
{
62+
this.load.scenePlugin('Camera3DPlugin', 'plugins/camera3d.min.js', 'Camera3DPlugin', 'cameras3d');
63+
64+
this.load.image('particle', 'assets/sprites/mushroom2.png');
65+
}
66+
67+
function create ()
68+
{
69+
camera = this.cameras3d.add(85).setZ(300).setPixelScale(128);
70+
71+
var sprites = camera.createRect({ x: 4, y: 4, z: 16 }, { x: 48, y: 48, z: 32 }, 'particle');
72+
73+
// Our rotation matrix
74+
transform = new Phaser.Math.Matrix4().rotateX(-0.01).rotateY(-0.02).rotateZ(0.01);
75+
}
76+
77+
function update ()
78+
{
79+
camera.transformChildren(transform);
80+
81+
updateCamControls();
82+
}
83+
```
84+
3985
## Building the External Plugin
4086

4187
If you wish to edit the plugin use the following files:

0 commit comments

Comments
 (0)