Class enchant.gl.Camera3D
- Defined in: gl.enchant.js
Constructor Attributes | Constructor Name and Description |
---|---|
Class to set 3D scene camera
|
Field Attributes | Field Name and Description |
---|---|
Camera perspective x coordinates
|
|
Camera perspective y coordinates
|
|
Camera perspective z coordinates
|
|
projection matrix
|
|
Camera upper vector x component
|
|
Camera upper vector y component
|
|
Camera upper vector z component
|
|
Camera x coordinates
|
|
Camera y coordinates
|
|
Camera z coordinates
|
Method Summary
Method Attributes | Method Name and Description |
---|---|
altitude(speed)
Moves up Camera3D.
|
|
chase(sprite, position, speed)
Bring camera position closer to that of Sprite3D.
|
|
forward(speed)
Moves forward Camera3D.
|
|
lookAt(sprite)
Fit camera perspective to Sprite3D position.
|
|
rotatePitch(radius)
Rotate Camera3D in local X acxis.
|
|
rotateRoll(radius)
Rotate Camera3D in local Z acxis.
|
|
rotateYaw(radius)
Rotate Camera3D in local Y acxis.
|
|
sidestep(speed)
Moves side Camera3D.
|
Class Detail
enchant.gl.Camera3D()
Class to set 3D scene camera
var scene = new Scene3D(); var camera = new Camera3D(); camera.x = 0; camera.y = 0; camera.z = 10; scene.setCamera(camera);
Field Detail
{Number}
centerX
Camera perspective x coordinates
{Number}
centerY
Camera perspective y coordinates
{Number}
centerZ
Camera perspective z coordinates
projMat
projection matrix
{Number}
upVectorX
Camera upper vector x component
{Number}
upVectorY
Camera upper vector y component
{Number}
upVectorZ
Camera upper vector z component
{Number}
x
Camera x coordinates
{Number}
y
Camera y coordinates
{Number}
z
Camera z coordinates
Method Detail
-
altitude(speed)Moves up Camera3D.
- Parameters:
- {Number} speed
-
chase(sprite, position, speed)Bring camera position closer to that of Sprite3D.
var sp = new Sprite3D(); var camera = new Camera3D(); // Continue approaching camera position from 10 behind while focusing on sp sp.addEventListener('enterframe', function() { camera.lookAt(sp); camera.chase(sp, -10, 20); });
- Parameters:
- {enchant.gl.Sprite3D} sprite
- Target Sprite3D
- {Number} position
- Distance from target
- {Number} speed
- Speed of approach to target
-
forward(speed)Moves forward Camera3D.
- Parameters:
- {Number} speed
-
lookAt(sprite)Fit camera perspective to Sprite3D position.
- Parameters:
- {enchant.gl.Sprite3D} sprite
- Sprite3D being focused on
-
rotatePitch(radius)Rotate Camera3D in local X acxis.
- Parameters:
- {Number} radius
-
rotateRoll(radius)Rotate Camera3D in local Z acxis.
- Parameters:
- {Number} radius
-
rotateYaw(radius)Rotate Camera3D in local Y acxis.
- Parameters:
- {Number} radius
-
sidestep(speed)Moves side Camera3D.
- Parameters:
- {Number} speed