Home > three-story-controls > FreeMovementControls
Control scheme to move the camera with arrow/WASD keys and mouse wheel; and rotate the camera with click-and-drag events.
Signature:
export declare class FreeMovementControls implements BaseControls
Implements: BaseControls
Control scheme to move the camera with arrow/WASD keys and mouse wheel; and rotate the camera with click-and-drag events. On a touch device, 1 finger swipe rotates the camera, and 2 fingers tranlsate/move the camera.
Note: CSS property touch-action: none
will probably be needed on listener element.
See FreeMovementControlsProps for all properties that can be passed to the constructor.
const scene = new Scene()
const camera = new PerspectiveCamera(75, window.innerWidth / window.innerHeight, 0.1, 1000)
const cameraRig = new CameraRig(camera, scene)
const controls = new FreeMovementControls(cameraRig)
controls.enable()
// render loop
function animate(t) {
controls.update(t)
}
Constructor | Modifiers | Description |
---|---|---|
(constructor)(cameraRig, props) | Constructs a new instance of the FreeMovementControls class |
Property | Modifiers | Type | Description |
---|---|---|---|
cameraRig | CameraRig |
Method | Modifiers | Description |
---|---|---|
disable() | ||
enable() | ||
isEnabled() | ||
update(time) |