Constructor
new CameraControl3D(targetopt, distanceopt, pitchopt, idleSpinopt)
Create a camera control, it drives render3D.camera every frame
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
target | Vector3 | <optional> | The point to look at, its pos3D | |
distance | number | <optional> | 10 | How far the camera sits from the target |
pitch | number | <optional> | 0.4 | Angle above the horizon, PI/2 looks straight down |
idleSpin | number | <optional> | 0 | Turned each frame while not dragging, 0 holds still |
- Source
new CameraControl3D(vec3(0, 1, 0), 15); // look at a point from 15 units awayExtends
- EngineObject3D
Members
distance
Properties| Type | Description |
|---|---|
| number | How far the camera sits from the target |
- Source
dragButton
Properties| Type | Description |
|---|---|
| number | Mouse button that turns the camera, 0 is left and 2 is right |
- Source
dragSpeed
Properties| Type | Description |
|---|---|
| number | How far dragging a pixel turns the camera |
- Source
idleSpin
Properties| Type | Description |
|---|---|
| number | Turned each frame while not dragging |
- Source
pitch
Properties| Type | Description |
|---|---|
| number | Angle above the horizon |
- Source
pitchRange
Properties| Type | Description |
|---|---|
| Vector2 | Lowest and highest pitch, so it cannot tip over the top |
- Source
yaw
Properties| Type | Description |
|---|---|
| number | Angle around the target, dragging changes it |
- Source
zoomRange
Properties| Type | Description |
|---|---|
| Vector2 | Closest and furthest the wheel can zoom to |
- Source
zoomSpeed
Properties| Type | Description |
|---|---|
| number | How much one wheel notch zooms, 0 turns zooming off |
- Source
Methods
render3D()
Camera controls draw nothing
- Source
update()
Read the mouse and put the camera on its orbit, called automatically each frame
- Source