Skip to content

Repository files navigation

Three.js Gamepad Controls

Three.js Gamepad Controls logo featuring a white gamepad with black geometric outlines above the wordmark.

Gamepad support for Three.js controls, built on top of Web Gamepad API.

Warning

This library has not reached version 1.0.0 and should not yet be considered stable. Until 1.0.0, minor releases may include breaking changes.

🏗️ Architecture

Layered architecture showing the shared gamepad input foundation branching into direct application input and Three.js control integrations.

The library is organized around GamepadInput, which owns the internal gamepad manager for selection and polling, exposes buttons, axes, sticks, haptics, and standard mappings, and processes stick reads through ordered, reusable, stateless pipelines. Applications can consume it directly for gameplay, menus, and custom interactions, or use GamepadControls and its ready-made or custom wrappers to integrate with Three.js. Each wrapper action resolves its own axes and pipeline.

📦 Installation

npm:

npm i three three-gamepad-controls
npm i -D @types/three # optional: for TypeScript projects

pnpm:

pnpm add three three-gamepad-controls
pnpm add -D @types/three # optional: for TypeScript projects

Yarn:

yarn add three three-gamepad-controls
yarn add -D @types/three # optional: for TypeScript projects

Deno:

When using deno.json, Deno stores dependencies in imports and does not separate devDependencies; -D only applies when writing to package.json.

# deno.json
deno add three @types/three three-gamepad-controls
# package.json
deno add --package-json three three-gamepad-controls
deno add --package-json -D @types/three # optional: for TypeScript projects

Bun:

bun add three three-gamepad-controls
bun add -d @types/three # optional: for TypeScript projects

📖 Documentation

About

Gamepad support for Three.js controls.

Topics

Resources

Stars

7 stars

Watchers

0 watching

Forks

Releases

Contributors

Languages