1.0.2 • Published 11 months ago

@verseengine/three-touch-controller v1.0.2

Weekly downloads
-
License
MIT
Repository
github
Last release
11 months ago

three-touch-controller

Joystick for touch operation.

preview

Installation

npm

npm install @verseengine/three-touch-controller

CDN (ES Mobules)

<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>

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);
});

Reference

API Reference

Link

1.0.2

11 months ago

1.0.1

11 months ago

1.0.0

11 months ago