Constructor
new FirstPersonCamera3D(pos3Dopt, yawopt, pitchopt)
Create a first person camera, it drives render3D.camera every frame
| Name | Type | Attributes | Description |
|---|---|---|---|
pos3D | Vector3 | <optional> | Where the eye is, defaults to where the camera is now |
yaw | number | <optional> | Radians around Y, defaults to the camera's |
pitch | number | <optional> | Radians up from level, defaults to the camera's |
- Source
const player = new FirstPersonCamera3D(vec3(0, 1.5, 5));
player.size3D = vec3(1); // bump into solid objects
player.collideAsSphere3D = true;
player.setCollision();Extends
- EngineObject3D
Members
fly
Properties| Type | Description |
|---|---|
| boolean | Move the way it looks, up and down included, instead of walking level |
- Source
lockPointer
Properties| Type | Description |
|---|---|
| boolean | Capture the mouse on a click, so looking needs no button held |
- Source
lookSpeed
Properties| Type | Description |
|---|---|
| number | How far a pixel of mouse movement turns the view |
- Source
moveSpeed
Properties| Type | Description |
|---|---|
| number | World units per frame at full speed |
- Source
pitch
Properties| Type | Description |
|---|---|
| number | Angle up from level, the mouse tilts it |
- Source
pitchRange
Properties| Type | Description |
|---|---|
| Vector2 | Lowest and highest pitch |
- Source
yaw
Properties| Type | Description |
|---|---|
| number | Angle around Y, the mouse turns it |
- Source
Methods
destroy(immediateopt)
Let go of the mouse and stop driving the camera
| Name | Type | Attributes | Description |
|---|---|---|---|
immediate | boolean | <optional> |
- Source
render3D()
Camera controls draw nothing
- Source
update()
Read the mouse and keys and put the camera at the eye, called automatically each frame
- Source