Skip to content

Latest commit

 

History

History
39 lines (30 loc) · 771 Bytes

File metadata and controls

39 lines (30 loc) · 771 Bytes

@webvoxel/plugin-wasdcontrols

WASD controls for WebVoxel

Usage

Without pointer locking

import { Game, World } from '@webvoxel/core';
import { WASDControlsPlugin} from '@webvoxel/plugin-wasdcontrols';

const wasd = new WASDControlsPlugin();

const game = new Game({
    plugins: [
        wasd,
    ],
    initialWorld: new World(),
});

game.start();

With pointer locking

import { Game, World } from '@webvoxel/core';
import { WASDControlsPlugin} from '@webvoxel/plugin-wasdcontrols';

const wasd = new WASDControlsPlugin();

const game = new Game({
    plugins: [
        wasd,
    ],
    initialWorld: new World(),
});

game.start();

game.renderer.domElement.addEventListener('click', () => wasd.controls.lock());