Game Development Reference
In-Depth Information
Constructor
Important properties
Explanation
PathControls
duration = 10000
waypoints = []
lookSpeed = 0.005
lookVertical =
true
lookHorizontal =
true
Move along a predefined route
and look around by following
the mouse.
PointerLockControls
Keyboard movement ( WASD
or arrow keys for forward/
back/strafe/jump) and look
around by locking to the mouse.
Requires that the canvas is in
pointer lock mode.
TrackballControls
enabled = true
rotateSpeed = 1.0
zoomSpeed = 1.2
panSpeed = 0.3
minDistance = 0
maxDistance =
Infinity
Rotate, pan, zoom, and tilt with
mouse or touch controls.
TransformControls
size = 1
Creates a widget around an
object that allows users to rotate,
scale, and translate it. Mainly
used in an editor.
All the controller constructors take camera as their first parameter.
Let's add the FirstPersonControls controller to our city example from the last
chapter and try flying around to see the city from the streets. First, we need to add
the JavaScript file:
<script src="FirstPersonControls.js"></script>
Then, we'll add some globals:
var controls, clock;
Search WWH ::




Custom Search