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, clamped to pitchRange |
idleSpin | number | <optional> | 0 | Turned each frame while not dragging, 0 holds still |
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 |
dragButton
Properties| Type | Description |
|---|---|
| number | Mouse button that turns the camera, 0 is left and 2 is right |
dragSpeed
Properties| Type | Description |
|---|---|
| number | How far dragging a pixel turns the camera |
idleSpin
Properties| Type | Description |
|---|---|
| number | Turned each frame while not dragging |
pitch
Properties| Type | Description |
|---|---|
| number | Angle above the horizon |
pitchRange
Properties| Type | Description |
|---|---|
| Vector2 | Lowest and highest pitch, so it cannot tip over the top, widened to hold the pitch given |
yaw
Properties| Type | Description |
|---|---|
| number | Angle around the target, dragging changes it |
zoomRange
Properties| Type | Description |
|---|---|
| Vector2 | Closest and furthest the wheel can zoom to |
zoomSpeed
Properties| Type | Description |
|---|---|
| number | How much one wheel notch zooms, 0 turns zooming off |
Methods
render3D()
Camera controls draw nothing
update()
Read the mouse and put the camera on its orbit, called automatically each frame