Joystick for touch operation.
npm install @verseengine/three-touch-controller
<script
async
src="https://cdn.jsdelivr.net/npm/es-module-shims@1.6.2/dist/es-module-shims.min.js"
></script>
<script type="importmap">
{
"imports": {
"three": "https://cdn.jsdelivr.net/npm/three@0.137.0/build/three.module.js",
"three-touch-controller": "https://cdn.jsdelivr.net/npm/@verseengine/three-touch-controller@1.0.1/dist/esm/index.js"
}
}
</script>
npm run example
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);
});