Agent skill

Vtj Input System

by hexianWeb in hexianWeb/Third-Person-MC

Handles mouse, keyboard, and touch input via the IMouse and InputManager systems.

MITAuto-check passedGame Development

Install Vtj Input System

skills CLI
$ npx skills add hexianWeb/Third-Person-MC --skill vtj-input-system -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install hexianWeb/Third-Person-MC vtj-input-system --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/hexianWeb/Third-Person-MC.git skills-src && mkdir -p .claude/skills && cp -r skills-src/.agent/skills/vtj-input-system .claude/skills/vtj-input-system && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
vtj-input-system
GitHub stars
194
Token cost
~1.8k tokens
SKILL.md length
177 words
Files
1
Skills in repo
12
Repo updated
First seen
Licence
MIT

At a glance

Handles mouse, keyboard, and touch input via the IMouse and InputManager systems.

  • Works in 2 steps: InputManager 中添加按键处理 → 组件中监听事件
  • Implementing controls
  • SKILL.md covers Overview, When to Use, 输入架构 and IMouse:位置追踪, plus 7 more sections
  • Instructions only: no scripts, shell commands, URLs or credentials in SKILL.md

What it does

Vtj Input System is an agent skill from hexianWeb/Third-Person-MC. Handles mouse, keyboard, and touch input via the IMouse and InputManager systems. Use when implementing controls, raycasting, or FPS-style PointerLock.

Its SKILL.md is about 1.8k tokens, which your agent loads only when the skill is triggered. It is a single SKILL.md file with no bundled scripts.

It sits in Game Development, covering 3D graphics and WebGL. It works with Three.js. The repository describes itself as: Three.js web version Minecraft in browser. The licence is MIT.

When your agent uses it

  • Implementing controls
  • FPS-style PointerLock

Example prompts

  • “Use the vtj-input-system skill to handle mouse, keyboard, and touch input via the IMouse and InputManager systems”
  • “/vtj-input-system”

Workflow steps

2 steps, taken from the step headings in SKILL.md.

  1. InputManager 中添加按键处理
  2. 组件中监听事件

What it can do on your machine

Read from SKILL.md and the folder at commit 490203c. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    No scripts in the folder and no shell commands in SKILL.md (its code samples are javascript).

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    No URLs in SKILL.md.

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Vtj Input System loads about 1.8k tokens when it runs. Until then it costs about 42 tokens; SKILL.md has 177 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~42
When it runs · the whole SKILL.md, loaded when a task matches
~1.8k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from hexianWeb/Third-Person-MC at commit 490203c, republished under its MIT licence (© hexianWeb). 177 words, ~1,783 tokens.

Download SKILL.mdSave it as .claude/skills/vtj-input-system/SKILL.md (or your agent's skills folder).
name
vtj-input-system
description
Handles mouse, keyboard, and touch input via the IMouse and InputManager systems. Use when implementing controls, raycasting, or FPS-style PointerLock.

vite-threejs Input System

Overview

本项目使用 三层输入系统:

  • IMouse:鼠标/触摸位置追踪,提供多种坐标格式
  • InputManager:键盘和鼠标按钮状态,通过 mitt 发送事件
  • PointerLockManager:FPS 风格鼠标锁定

核心原则:永远使用 iMouse.normalizedMouse 进行射线拾取,永远通过 mitt 事件消费输入。

When to Use

  • 实现鼠标交互(点击、拖拽、悬停)
  • 添加键盘控制
  • 进行射线拾取(Raycasting)
  • 处理相机控制输入

输入架构

Window Events (keydown/mousemove/etc)
         │
         ▼
┌────────────────────────────────────────────────────────────┐
│                      Input Layer                            │
│  ┌──────────────┐  ┌──────────────┐  ┌──────────────┐      │
│  │   IMouse     │  │ InputManager │  │ PointerLock  │      │
│  │ (positions)  │  │ (key states) │  │ (FPS mouse)  │      │
│  └──────┬───────┘  └──────┬───────┘  └──────┬───────┘      │
└─────────┼─────────────────┼─────────────────┼──────────────┘
          │                 │                 │
          ▼                 ▼                 ▼
┌────────────────────────────────────────────────────────────┐
│                    mitt Event Bus                           │
│         input:update, input:jump, input:mouse_move          │
└────────────────────────────────────────────────────────────┘
          │
          ▼
┌────────────────────────────────────────────────────────────┐
│                   Consumer Layer                            │
│   Player, CameraRig, BlockInteraction, BlockRaycaster       │
└────────────────────────────────────────────────────────────┘

IMouse:位置追踪

访问方式
javascript
// 通过 Experience 单例访问
this.iMouse = this.experience.iMouse
可用属性
属性类型说明
normalizedMouseVector2NDC 坐标 [-1, 1],用于射线拾取
mouseVector2左下角原点坐标
mouseDOMVector2DOM 坐标 (clientX, clientY)
mouseScreenVector2屏幕中心相对坐标
mouseDOMDeltaVector2帧间位移
isMouseMovingboolean鼠标是否移动中
射线拾取(MANDATORY PATTERN)
javascript
// ✅ ALWAYS: 使用 iMouse.normalizedMouse
const ndc = this.iMouse.normalizedMouse
this.raycaster.setFromCamera(ndc, this.camera)
const intersects = this.raycaster.intersectObjects(this.scene.children)

// ❌ NEVER: 手动计算 NDC
const x = (event.clientX / window.innerWidth) * 2 - 1   // 禁止!
const y = -(event.clientY / window.innerHeight) * 2 + 1 // 禁止!

屏幕中心射线(第一人称准星):

javascript
const CENTER_SCREEN = new THREE.Vector2(0, 0)
this.raycaster.setFromCamera(CENTER_SCREEN, this.camera)

InputManager:按键事件

事件列表
事件触发条件数据
input:update任意按键变化{ forward, backward, left, right, shift, space, ... }
input:jump空格键按下无
input:punch_straightZ 键无
input:punch_hookX 键无
input:blockC 键{ isPressed: boolean }
input:toggle_camera_sideTab 键无
input:mouse_down鼠标按下`{ button: 0
input:mouse_up鼠标释放`{ button: 0
input:wheel滚轮{ deltaY: number }
ui:escapeESC 键无
消费输入事件
javascript
import emitter from './utils/event-bus.js'

export default class Player {
  constructor() {
    // 保存绑定引用以便清理
    this._handleInput = this._handleInput.bind(this)
    this._handleJump = this._handleJump.bind(this)
    
    emitter.on('input:update', this._handleInput)
    emitter.on('input:jump', this._handleJump)
  }
  
  _handleInput(keys) {
    this.inputState = keys
    // keys = { forward: true, backward: false, left: false, right: true, shift: false, ... }
  }
  
  _handleJump() {
    if (this.movement.isGrounded) {
      this.movement.jump()
    }
  }
  
  destroy() {
    emitter.off('input:update', this._handleInput)
    emitter.off('input:jump', this._handleJump)
  }
}

PointerLockManager:FPS 鼠标

事件列表
事件说明数据
pointer:locked鼠标锁定成功无
pointer:unlocked鼠标解锁无
input:mouse_move相对鼠标移动{ movementX, movementY }
相机控制示例
javascript
// 在 CameraRig 中
constructor() {
  this._handleMouseMove = this._handleMouseMove.bind(this)
  emitter.on('input:mouse_move', this._handleMouseMove)
}

_handleMouseMove({ movementX, movementY }) {
  // Y 轴:控制相机俯仰
  this.mouseYVelocity += movementY * this.config.sensitivity
  
  // X 轴:通常在 Player 中处理,控制角色朝向
}

destroy() {
  emitter.off('input:mouse_move', this._handleMouseMove)
}
玩家朝向控制
javascript
// 在 Player 中
emitter.on('input:mouse_move', ({ movementX }) => {
  this.targetFacingAngle -= movementX * this.config.mouseSensitivity
})

输入解析器

用于处理冲突输入(如同时按 W+S):

javascript
import { resolveDirectionInput } from './input-resolver.js'

const rawInput = { forward: true, backward: true, left: false, right: true }
const { resolvedInput, weights } = resolveDirectionInput(rawInput)

// resolvedInput = { forward: false, backward: false, left: false, right: true }
// W+S 互相抵消,只保留 D

添加新输入动作

Step 1: InputManager 中添加按键处理
javascript
// src/js/utils/input.js
updateKey(key, isDown) {
  switch (key) {
    case 'KeyQ':
      this.keyStates.q = isDown
      if (isDown) emitter.emit('input:new_action')
      break
    // ...
  }
}
Step 2: 组件中监听事件
javascript
emitter.on('input:new_action', () => {
  this.performNewAction()
})

设备检测

javascript
import { detectDeviceType } from './tools/dom.js'

const device = detectDeviceType()
if (device === 'Desktop') {
  // 键鼠控制
} else {
  // 触摸控制
}

Common Mistakes

❌ 手动计算 NDC 坐标
javascript
// BAD: 自己计算
onMouseMove(event) {
  const x = (event.clientX / window.innerWidth) * 2 - 1
  const y = -(event.clientY / window.innerHeight) * 2 + 1
  this.raycaster.setFromCamera(new THREE.Vector2(x, y), this.camera)
}

// GOOD: 使用 IMouse
update() {
  const ndc = this.experience.iMouse.normalizedMouse
  this.raycaster.setFromCamera(ndc, this.camera)
}
❌ 直接监听 window 事件
javascript
// BAD: 绕过输入系统
window.addEventListener('keydown', (e) => {
  if (e.code === 'Space') this.jump()
})

// GOOD: 使用 mitt 事件
emitter.on('input:jump', () => this.jump())
❌ 忘记清理事件监听
javascript
// BAD: 没有 destroy
constructor() {
  emitter.on('input:update', this.handleInput.bind(this))
}

// GOOD: 保存引用并清理
constructor() {
  this._boundHandler = this.handleInput.bind(this)
  emitter.on('input:update', this._boundHandler)
}
destroy() {
  emitter.off('input:update', this._boundHandler)
}
❌ 在 update() 中轮询按键
javascript
// BAD: 每帧检查按键状态
update() {
  if (keyboard.isKeyDown('Space')) this.jump() // 会重复触发
}

// GOOD: 事件驱动
emitter.on('input:jump', () => this.jump()) // 只触发一次

Quick Reference

需求使用
射线拾取坐标this.iMouse.normalizedMouse
按键状态emitter.on('input:update', ...)
单次按键动作emitter.on('input:jump', ...)
鼠标相对移动emitter.on('input:mouse_move', ...)
滚轮emitter.on('input:wheel', ...)
鼠标点击emitter.on('input:mouse_down', ...)
禁止原因
手动计算 NDC不一致,易出错
直接监听 window 事件绕过输入系统
匿名事件监听器无法清理

© hexianWeb, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

Just SKILL.md in .agent/skills/vtj-input-system of hexianWeb/Third-Person-MC.

Open the folder on GitHubat commit 490203c

Compare with similar skills

Vtj Input System next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Vtj Input System compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Vtj Input System this skillhexianWeb/Third-Person-MC194—~1.8kAutomated safety check: PassMIT
Image to Three.js Modelimg2threejs/img2threejs18k1 repos~8.2kAutomated safety check: PassApache-2.0
Web CloneJane-xiaoer/claude-skill-web-clone1k1 repos~2.7kAutomated safety check: PassMIT
Threejs Game Directormajidmanzarpour/threejs-game-skills2.4k—~2.2kAutomated safety check: PassMIT
Threejs Gameplay Systemsvalkor-ai/loom1.2k1 repos~1.4kAutomated safety check: PassApache-2.0
Threejs World Generationcalesthio/OpenMontage65k—~2kAutomated safety check: PassAGPL-3.0

Similar skills

  • Image to Three.js Model

    img2threejs/img2threejs

    Rebuilds the object in a reference image as a procedural, animation-ready Three.js model written entirely in code, using staged sculpting with quality checks.

    18k GitHub starsUsed in 1 repo~8.2k tokens
    Game DevelopmentAuto-check passed
  • Web Clone

    Jane-xiaoer/claude-skill-web-clone

    网站复刻 / 克隆方法论。USE WHEN 用户说 复刻网站、克隆网站、clone website、抄个站、仿站、 照着这个站做一个、reproduce site、还原某个网页效果、把这个站搬下来改成我的、 复刻某个交互/WebGL/Canvas/Three.js 效果。提供「先拿真源码 → 判路径 → 逆向拆解 → 搭工程 → 替换内容」的可移植决策树,覆盖静态站 /…

    1k GitHub starsUsed in 1 repo~2.7k tokens
    Game DevelopmentAuto-check passed
  • Threejs Game Director

    majidmanzarpour/threejs-game-skills

    Entrypoint for building, upgrading, and finishing Three.js browser games.

    2.4k GitHub stars~2.2k tokensUpdated 9 days ago
    Game DevelopmentAuto-check passed
  • Build and iterate playable Three.js game systems: starter scaffold, architecture, design briefs, core loops, level and encounter design, entities, input, camera, collision and physics, scoring…

    1.2k GitHub starsUsed in 1 repo~1.4k tokens
    Game DevelopmentAuto-check passed
  • Threejs World Generation

    calesthio/OpenMontage

    Build deterministic, editable, free-viewpoint Three.js worlds from text or structured briefs.

    65k GitHub stars~2k tokensUpdated 4 days ago
    Game DevelopmentAuto-check passed
  • 3Dviz Pro Max Scene Builder

    viettranx/3dviz-pro-max

    Guides building an expressive 3D scene in Three.js or Blender by reasoning through intent, object construction and scientific grounding before using a catalog of recipes and kits.

    675 GitHub stars~2.8k tokensUpdated 27 days ago
    Game DevelopmentAuto-check passed

More from hexianWeb/Third-Person-MC

All 12 skills in this repo
  • Vtj Debug Panel

    hexianWeb/Third-Person-MC

    Configures Tweakpane debug panels for 3D components. An agent skill from hexianWeb/Third-Person-MC.

    194 GitHub stars~638 tokensUpdated 2 mo ago
    Auto-check passed
  • Vtj Camera System

    hexianWeb/Third-Person-MC

    Configures third-person camera systems with collision avoidance.

    194 GitHub stars~1.9k tokensUpdated 2 mo ago
    Auto-check passed
  • Vtj Component Model

    hexianWeb/Third-Person-MC

    Creates 3D components using the Experience singleton pattern.

    194 GitHub stars~1.5k tokensUpdated 2 mo ago
    Auto-check passed
  • Vtj Performance

    hexianWeb/Third-Person-MC

    Optimizes Three.js rendering performance. An agent skill from hexianWeb/Third-Person-MC.

    194 GitHub stars~802 tokensUpdated 2 mo ago
    Auto-check passed
  • Vtj Raycasting System

    hexianWeb/Third-Person-MC

    Implements ray picking and collision detection. An agent skill from hexianWeb/Third-Person-MC.

    194 GitHub stars~2k tokensUpdated 2 mo ago
    Auto-check passed
  • Vtj Resource Management

    hexianWeb/Third-Person-MC

    Loads and manages 3D assets via the Resources system. An agent skill from hexianWeb/Third-Person-MC.

    194 GitHub stars~1.6k tokensUpdated 2 mo ago
    Auto-check passed

Works with

Questions about Vtj Input System

What does Vtj Input System do?

Handles mouse, keyboard, and touch input via the IMouse and InputManager systems. Vtj Input System is an agent skill from hexianWeb/Third-Person-MC. Handles mouse, keyboard, and touch input via the IMouse and InputManager systems.

When should I use Vtj Input System?

Vtj Input System fits situations like: implementing controls; FPS-style PointerLock.

How do I install Vtj Input System in Claude Code?

Run `npx skills add hexianWeb/Third-Person-MC --skill vtj-input-system -a claude-code`. Or copy the skill folder (.agent/skills/vtj-input-system in hexianWeb/Third-Person-MC) into .claude/skills/vtj-input-system in your project. Claude Code loads it when a task matches its description.

How do I install Vtj Input System in Codex?

Run `npx skills add hexianWeb/Third-Person-MC --skill vtj-input-system -a codex`. Or copy the skill folder (.agent/skills/vtj-input-system in hexianWeb/Third-Person-MC) into .agents/skills/vtj-input-system in your project. Codex loads it when a task matches its description.

Can I use Vtj Input System in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add hexianWeb/Third-Person-MC --skill vtj-input-system -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/vtj-input-system, .gemini/skills/vtj-input-system, .github/skills/vtj-input-system and .opencode/skills/vtj-input-system in your project.

What does Vtj Input System need to run?

SKILL.md names no scripts, command-line tools or credentials: Vtj Input System is instructions for the agent only.

Does Vtj Input System access the network?

SKILL.md contains no URLs. Any network use would come from the scripts or tools the agent runs. This is read from the text; nothing was executed.

Is Vtj Input System safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does Vtj Input System use?

Vtj Input System is published under the MIT licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Vtj Input System use?

About 1.8k tokens (SKILL.md is roughly 7.1k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.

What are the alternatives to Vtj Input System?

Skills that share tags, products or a category with Vtj Input System: Image to Three.js Model (img2threejs/img2threejs, 18k stars), Web Clone (Jane-xiaoer/claude-skill-web-clone, 1k stars), Threejs Game Director (majidmanzarpour/threejs-game-skills, 2.4k stars) and Threejs Gameplay Systems (valkor-ai/loom, 1.2k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Vtj Input System?

hexianWeb (a GitHub user) maintains it in hexianWeb/Third-Person-MC, which has 194 GitHub stars. The repository holds 12 skills in this directory. The repository was last updated on July 27, 2026.

Source: hexianWeb/Third-Person-MC on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.