@verseengine/three-touch-controller
v1.0.2
Published
Joystick for touch operation
Downloads
8
Readme
three-touch-controller
Joystick for touch operation.
Installation
npm
npm install @verseengine/three-touch-controller
CDN (ES Mobules)
<script
async
src="https://cdn.jsdelivr.net/npm/[email protected]/dist/es-module-shims.min.js"
></script>
<script type="importmap">
{
"imports": {
"three": "https://cdn.jsdelivr.net/npm/[email protected]/build/three.module.js",
"three-touch-controller": "https://cdn.jsdelivr.net/npm/@verseengine/[email protected]/dist/esm/index.js"
}
}
</script>
Example
npm run example
Usage
import * as THREE from "three";
import { TouchController } from "three-touch-controller";
const playerEl:Object3D = ...;
const touchController = new TouchController(playerEl);
...
const clock = new THREE.Clock();
renderer.setAnimationLoop(() => {
const dt = clock.getDelta();
touchController.tick(dt);
});