https://github.com/freddysae0/threejs-aim-trainer
Aim trainer, made in three js
https://github.com/freddysae0/threejs-aim-trainer
Last synced: about 2 months ago
JSON representation
Aim trainer, made in three js
- Host: GitHub
- URL: https://github.com/freddysae0/threejs-aim-trainer
- Owner: freddysae0
- License: mit
- Created: 2025-07-30T16:24:03.000Z (11 months ago)
- Default Branch: master
- Last Pushed: 2025-08-23T06:29:45.000Z (10 months ago)
- Last Synced: 2025-08-24T09:33:17.011Z (10 months ago)
- Language: TypeScript
- Homepage: https://aim.freddyjs.es
- Size: 17.7 MB
- Stars: 2
- Watchers: 0
- Forks: 1
- Open Issues: 2
-
Metadata Files:
- Readme: readme.md
- License: LICENSE
Awesome Lists containing this project
README
# Aim trainer for shooters, (in ThreeJS)
๐ฎ Game Preview
## How to install
```bash
npm install
```
## How to run
```bash
npm run dev
```
## How to build
```bash
npm run build
```
## How to preview
```bash
npm run preview
```
---
## ๐ฎ Gameplay & Controls
| Action | Key/Mouse |
|--------|-----------|
| Move Forward / Back | `W` / `S` |
| Strafe Left / Right | `A` / `D` |
| Shoot | `Left Click` |
| Crouch | `C` (hold) |
| Jump | `Space` |
| Lock Pointer | `Click` inside canvas |
| Start Round | `Space` |
Use the **sensitivity slider** in the start screen to fine-tune mouse sensitivity. The value is stored in `localStorage` so your preference persists across sessions.
## โจ Features
* Three target presets (3, 8, 50) for quick warm-ups.
* Procedurally generated colored cubes that become shootable one at a time.
* Animated target absorption effect when hit.
* Die-cut cell-shaded pistol model that follows camera rotation.
* FPS-style WASD movement with adjustable sensitivity and inertia.
* Built-in timer that stops automatically when the last target disappears.
* Post-processing pipeline (`EffectComposer`, FXAA pass) ready for expansion.
* Fully written in **TypeScript** + **Three.js** and bundled with **Vite**.
## ๐๏ธ Project Structure
```text
three-shooter/
โโโ public/ # Static assets (models, textures, iconsโฆ)
โโโ src/
โ โโโ core/ # Engine wrappers (Camera, Renderer, Loop, App)
โ โโโ objects/ # 3D objects & generators (Cube, Pistol โฆ)
โ โโโ scenes/ # Three.js scenes (MainScene)
โ โโโ systems/ # Behaviour modules (ControlsWithMovement)
โ โโโ ui/ # DOM-based UI overlays (StartScreen)
โ โโโ main.ts # Vite entry point
โโโ index.html # Game container & UI markup
โโโ package.json # NPM scripts & deps
โโโ tsconfig.json # TypeScript configuration
```
## ๐ ๏ธ Tech Stack
* **Three.js** โ WebGL abstraction layer for 3D rendering.
* **TypeScript** โ Static typing for safer code.
* **Vite** โ Lightning-fast dev server & bundler.
* **Post-processing Addons** โ `EffectComposer`, `RenderPass`, `FXAAShader`.
## ๐ง Configuration
| Option | Location | Description |
|--------|----------|-------------|
| Mouse sensitivity | `localStorage` key `mouseSensitivity` | Set via slider on start screen. Multiplies base rotation speed. |
| Renderer quality | `src/core/Renderer.ts` | Change antialias, pixel ratio, post FX. |
| Target counts | `src/scenes/MainScene.ts` | `level1/2/3()` generate different numbers of cubes. |
## ๐ Available NPM Scripts
| Script | Purpose |
|--------|---------|
| `npm run dev` | Local dev server on `localhost:5173`. |
| `npm run build` | Production build to `dist/`. |
| `npm run preview` | Preview the production build locally. |
## ๐ฆ Assets
* `public/models/pistol.glb` โ Low-poly pistol model.
* `preview.gif` โ Gameplay preview used in this README.
* `controls.png` โ Legend for keyboard controls shown in HUD.
## ๐ Deployment
The final build is static and can be deployed to any static host (Netlify, GitHub Pages, Vercelโฆ).
```bash
npm run build
# copy dist/ to your preferred host
```
## ๐ค Author
*Freddy Sae*
Feel free to open issues or PRs!
## ๐ License
This project is released under the **MIT License** โ see [`LICENSE`](LICENSE) for details.