Logotipo de Threejs Syntax Controls

Threejs Syntax Controls

Organización
Impertio-Studio
threejs-syntax-controls

Use when adding camera controls to a Three.js scene: orbit, pan, zoom, fly, first-person, or object manipulation. Prevents the common mistake of forgetting controls.update() in the render loop, not calling dispose(), or mixing controls. Covers OrbitControls, MapControls, FlyControls, PointerLockControls, TransformControls. Keywords: OrbitControls, controls, camera controls, orbit, pan, zoom, MapControls, FlyControls, PointerLockControls, TransformControls, rotate view, move camera, mouse controls, drag to rotate.

Descripción general

EditorImpertio-Studio
RepositorioThree.js-Claude-Skill-Package
Nombre de la habilidadthreejs-syntax-controls
Estrellas
29
Forks
3
Archivos incluidos
3
LicenciaMIT
Enlaces
  • Instrucciones en Markdown

    Un archivo SKILL.md que el modelo carga cuando lo necesita, de modo que solo consume tokens cuando una petición es realmente relevante.

  • Funciona con cualquier LLM

    Las habilidades de IA están en Markdown, no en código específico de un proveedor, por lo que funcionan con GPT, Claude, Gemini, Grok o un modelo local.

  • 3 archivos incluidos

    Scripts, plantillas y referencias que el modelo puede leer mientras trabaja. Los archivos son de solo lectura y nunca se ejecutan.

  • Código abierto

    Publicada por Impertio-Studio en GitHub. Revisa el contenido original antes de instalarla.

Instalación

Instala la habilidad de IA Threejs Syntax Controls en TypingMind para usarla con cualquier LLM, o añádela a otro agente que lea SKILL.md.

1

Instalar en TypingMind

TypingMind instala una habilidad directamente desde su carpeta de GitHub: lee SKILL.md, empaqueta los archivos de recursos y guarda el resultado localmente.

  1. Abre la aplicación y ve a Plugins → Habilidades.
  2. Elige «Instalar desde GitHub».
  3. Pega la URL de la carpeta de la habilidad que se muestra a continuación y confirma.
    https://github.com/Impertio-Studio/Three.js-Claude-Skill-Package/tree/master/skills/source/threejs-syntax/threejs-syntax-controls
  4. Activa la habilidad en cada chat en el que quieras tenerla disponible.
Plugins → Habilidades → Añadir habilidad → Desde URL de GitHub; después, pega la URL de la carpeta y pulsa Continuar.
2

Instalar en otro agente

Cualquier agente que lea el formato Agent Skills puede usar esta habilidad: copia la carpeta en el directorio de habilidades de ese agente.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/Impertio-Studio/Three.js-Claude-Skill-Package.git /tmp/Three.js-Claude-Skill-Package
mkdir -p .claude/skills
cp -r /tmp/Three.js-Claude-Skill-Package/skills/source/threejs-syntax/threejs-syntax-controls .claude/skills/threejs-syntax-controls
Reinicia Claude Code después de copiarla para que detecte la nueva habilidad.

Úsala en TypingMind

Activa Threejs Syntax Controls en cualquier chat de TypingMind y el modelo se encargará del resto. Su nombre y descripción se incluyen en el prompt del sistema y, en cuanto una petición es relevante, el modelo carga las instrucciones completas por sí solo. No tienes que invocarla manualmente y no consume tokens hasta que se utiliza.

El modelo carga Threejs Syntax Controls automáticamente en cuanto una petición es relevante para esa habilidad.

Funciona con cualquier modelo de IA

Las habilidades de IA son instrucciones en Markdown, no código específico de un proveedor, por lo que Threejs Syntax Controls no está vinculada al modelo para el que se creó. Instálala una sola vez en TypingMind y úsala con GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama o un modelo local que ejecutes tú, todo con tus propias claves API.

  • Se carga solo cuando se necesita

    El prompt del sistema solo incluye el nombre y la descripción. Las instrucciones se cargan con la primera petición relevante, por lo que una habilidad que no se usa no supone ningún coste.

  • Cambia de modelo durante el chat

    Como la habilidad contiene instrucciones y no código, cambiar de modelo no impide que funcione: el nuevo modelo lee el mismo archivo SKILL.md.

Instrucciones de la habilidad

Este es el contenido de SKILL.md que carga el modelo. Léelo antes de instalar la habilidad: contiene instrucciones que tu modelo seguirá.

threejs-syntax-controls

Quick Reference

Control Selection Decision Tree

Use CaseControlWhy
Inspect a 3D model from all anglesOrbitControlsOrbit/pan/zoom around a target point
Top-down map or 2D-style navigationMapControlsLeft-drag pans, right-drag rotates
Free-flight editor or space sceneFlyControlsSix degrees of freedom, WASD + mouse
First-person game with pointer lockPointerLockControlsHides cursor, captures mouse movement
First-person without pointer lockFirstPersonControlsMouse-look without browser lock API
Move/rotate/scale objects via gizmoTransformControlsInteractive translate/rotate/scale handles
Drag objects along a planeDragControlsClick-and-drag object repositioning
Unconstrained rotation (no gimbal lock)ArcballControlsFull spherical rotation with animation
Unconstrained rotation (simpler)TrackballControlsLike OrbitControls but no pole constraint

Import Paths (Three.js r160+)

javascript
import { OrbitControls } from 'three/addons/controls/OrbitControls.js';
import { MapControls } from 'three/addons/controls/MapControls.js';
import { FlyControls } from 'three/addons/controls/FlyControls.js';
import { FirstPersonControls } from 'three/addons/controls/FirstPersonControls.js';
import { PointerLockControls } from 'three/addons/controls/PointerLockControls.js';
import { TransformControls } from 'three/addons/controls/TransformControls.js';
import { TrackballControls } from 'three/addons/controls/TrackballControls.js';
import { ArcballControls } from 'three/addons/controls/ArcballControls.js';
import { DragControls } from 'three/addons/controls/DragControls.js';

ALWAYS use 'three/addons/controls/...' for r160+. The legacy path 'three/examples/jsm/controls/...' still works but is deprecated.

Critical Warnings

ALWAYS call controls.update() in the animation loop when enableDamping or autoRotate is true. Failing to do so causes the camera to freeze after user interaction ends.

ALWAYS call controls.dispose() when removing controls. Failing to do so leaks DOM event listeners (pointermove, wheel, keydown) that cause memory leaks and ghost interactions.

NEVER attach two camera-control classes to the same camera simultaneously without disabling one. OrbitControls + FlyControls on the same camera causes erratic movement.

ALWAYS disable OrbitControls while TransformControls is dragging. Listen to the dragging-changed event and toggle orbitControls.enabled.

ALWAYS call PointerLockControls.lock() from a user gesture (click handler). Browsers reject pointer lock requests without user interaction.

ALWAYS pass delta time to FlyControls.update(delta). Passing no argument or passing elapsed time causes speed to depend on frame rate.


Controls Lifecycle

Every control follows the same lifecycle pattern:

construct --> configure --> attach to loop --> dispose on cleanup

Step 1: Construct

javascript
const controls = new OrbitControls(camera, renderer.domElement);

ALWAYS pass renderer.domElement as the second argument. Passing document or document.body causes controls to capture events globally, breaking UI overlays.

Step 2: Configure

javascript
controls.enableDamping = true;
controls.dampingFactor = 0.05;
controls.minDistance = 2;
controls.maxDistance = 50;
controls.target.set(0, 1, 0);

Step 3: Update in Render Loop

javascript
function animate() {
  requestAnimationFrame(animate);
  controls.update(); // REQUIRED when enableDamping or autoRotate is true
  renderer.render(scene, camera);
}
animate();

Step 4: Dispose on Cleanup

javascript
controls.dispose();

OrbitControls

The most commonly used control. Orbits, pans, and zooms around a target point.

Constructor

javascript
new OrbitControls(camera: THREE.Camera, domElement: HTMLElement)

Key Properties

PropertyTypeDefaultDescription
enabledbooleantrueEnable/disable all interaction
targetVector3(0,0,0)Orbit focus point
enableDampingbooleanfalseSmooth inertial movement
dampingFactornumber0.05Inertia strength (0-1)
autoRotatebooleanfalseAuto-rotate around target
autoRotateSpeednumber2.0Degrees/sec at 60fps
enablePanbooleantrueAllow panning
enableRotatebooleantrueAllow rotation
enableZoombooleantrueAllow zooming
minDistancenumber0Min zoom distance (PerspectiveCamera)
maxDistancenumberInfinityMax zoom distance (PerspectiveCamera)
minZoomnumber0Min zoom (OrthographicCamera)
maxZoomnumberInfinityMax zoom (OrthographicCamera)
minPolarAnglenumber0Min vertical angle (radians)
maxPolarAnglenumberMath.PIMax vertical angle (radians)
minAzimuthAnglenumber-InfinityMin horizontal angle (radians)
maxAzimuthAnglenumberInfinityMax horizontal angle (radians)
screenSpacePanningbooleantruePan in screen plane (true) or horizontal plane (false)
zoomToCursorbooleanfalseZoom towards cursor position
panSpeednumber1.0Pan speed multiplier
rotateSpeednumber1.0Rotation speed multiplier
zoomSpeednumber1.0Zoom speed multiplier
mouseButtonsobject{LEFT: ROTATE, MIDDLE: DOLLY, RIGHT: PAN}Mouse button mapping
touchesobject{ONE: ROTATE, TWO: DOLLY_PAN}Touch gesture mapping
keysobject{LEFT, UP, RIGHT, BOTTOM}Arrow key codes for panning

Methods

MethodSignatureDescription
update(deltaTime?)(number?) => booleanUpdate controls state. MUST call every frame with damping/autoRotate
dispose()() => voidRemove all event listeners
saveState()() => voidSave current camera position/target/zoom
reset()() => voidRestore to last saved state
getDistance()() => numberDistance from camera to target
getPolarAngle()() => numberVertical angle in radians
getAzimuthalAngle()() => numberHorizontal angle in radians
listenToKeyEvents(el)(HTMLElement) => voidEnable keyboard panning
stopListenToKeyEvents()() => voidDisable keyboard panning

Events

EventTrigger
changeCamera position or target changed
startUser interaction began (pointerdown)
endUser interaction ended (pointerup)

MapControls

Subclass of OrbitControls optimized for top-down map navigation.

ButtonOrbitControlsMapControls
Left mouseRotatePan
Middle mouseDollyDolly
Right mousePanRotate

All properties, methods, and events are identical to OrbitControls. The ONLY differences are the default mouseButtons mapping and screenSpacePanning defaulting to true.


FlyControls

Six-degrees-of-freedom flight camera. WASD for movement, QE for roll, RF for up/down.

Key Properties

PropertyTypeDefaultDescription
movementSpeednumber1.0Translation speed
rollSpeednumber0.005Roll rotation speed
dragToLookbooleanfalseRequire mouse drag to rotate (vs. always follow mouse)
autoForwardbooleanfalseMove forward automatically

Methods

  • update(delta) -- ALWAYS pass delta time from the clock. NEVER omit this argument.
  • dispose() -- Remove event listeners.

PointerLockControls

First-person camera using the Pointer Lock API. Hides and captures the mouse cursor.

Key Properties

PropertyTypeDefaultDescription
isLockedbooleanread-onlyWhether pointer is currently locked
maxPolarAnglenumberMath.PIMax vertical look angle
minPolarAnglenumber0Min vertical look angle
pointerSpeednumber1.0Mouse sensitivity multiplier

Methods

MethodDescription
lock()Request pointer lock (MUST call from user gesture)
unlock()Exit pointer lock
connect()Attach event listeners
disconnect()Remove event listeners
dispose()Full cleanup (calls disconnect)
getObject()Returns the controlled camera
getDirection(target)Write look direction into target Vector3
moveForward(distance)Move camera forward
moveRight(distance)Move camera sideways

Events

EventTrigger
changeCamera orientation changed
lockPointer lock acquired
unlockPointer lock released

ALWAYS implement your own WASD movement in the animation loop. PointerLockControls handles look direction only, NOT position.


TransformControls

Interactive gizmo for moving, rotating, and scaling scene objects.

Key Properties

PropertyTypeDefaultDescription
modestring'translate''translate', 'rotate', or 'scale'
spacestring'world''world' or 'local' coordinate space
showXbooleantrueShow X axis handle
showYbooleantrueShow Y axis handle
showZbooleantrueShow Z axis handle
sizenumber1Gizmo visual scale
translationSnap`numbernull`null
rotationSnap`numbernull`null
scaleSnap`numbernull`null
draggingbooleanread-onlyUser is currently dragging

Methods

MethodDescription
attach(object)Attach gizmo to a scene object
detach()Remove gizmo from current object
setMode(mode)Set transform mode
setSpace(space)Set coordinate space
setSize(size)Set gizmo scale
setTranslationSnap(snap)Set position snap
setRotationSnap(snap)Set rotation snap
setScaleSnap(snap)Set scale snap
getRaycaster()Access internal raycaster
dispose()Cleanup

Events

EventTrigger
changeGizmo visual changed
dragging-changedevent.value is true when dragging starts, false when it ends
objectChangeAttached object's transform was modified
mouseDownPointer pressed on gizmo
mouseUpPointer released from gizmo

Critical Integration Pattern

ALWAYS disable camera controls during gizmo drag:

javascript
transformControls.addEventListener('dragging-changed', (event) => {
  orbitControls.enabled = !event.value;
});

ALWAYS add TransformControls to the scene: scene.add(transformControls.getHelper()) or scene.add(transformControls).


Brief Overview: Other Controls

ArcballControls

Unconstrained rotation with animation states. No polar angle limit -- the camera rotates freely in all directions. Best for CAD-style model inspection.

TrackballControls

Like OrbitControls without the polar angle constraint. The camera can rotate past the poles. Properties: rotateSpeed, zoomSpeed, panSpeed, staticMoving, dynamicDampingFactor.

DragControls

Drag scene objects along a plane. Constructor: new DragControls(objects, camera, domElement). Events: dragstart, drag, dragend, hoveron, hoveroff.

FirstPersonControls

Mouse-look camera without pointer lock. Properties: movementSpeed, lookSpeed, activeLook, constrainVertical, verticalMin, verticalMax.


Reference Links

Official Sources

Archivos incluidos

El modelo los lee según los necesita mientras la habilidad está cargada. Se ofrecen como archivos de lectura y nunca se ejecutan.

Preguntas frecuentes

¿Qué hace la habilidad de IA Threejs Syntax Controls?

Use when adding camera controls to a Three.js scene: orbit, pan, zoom, fly, first-person, or object manipulation. Prevents the common mistake of forgetting controls.update() in the render loop, not calling dispose(), or mixing controls. Covers OrbitControls, MapControls, FlyControls, PointerLockControls, TransformControls. Keywords: OrbitControls, controls, camera controls, orbit, pan, zoom, MapControls, FlyControls, PointerLockControls, TransformControls, rotate view, move camera, mouse controls, drag to rotate.

¿Por qué usar Threejs Syntax Controls en TypingMind?

Porque la instalas una vez y la usas con cualquier modelo. Threejs Syntax Controls está escrita en Markdown, no en código específico de un proveedor, por lo que la misma habilidad funciona con GPT-5, Claude, Gemini, Grok o un modelo local, y puedes cambiar de modelo en mitad del chat sin que deje de funcionar. TypingMind utiliza tus propias claves API, de modo que pagas directamente a los proveedores en lugar de pagar una suscripción por puesto, y tus habilidades y chats permanecen en tu propio almacenamiento.

¿Cómo instalo Threejs Syntax Controls en TypingMind?

Abre Plugins → Habilidades → Instalar desde GitHub en TypingMind y pega https://github.com/Impertio-Studio/Three.js-Claude-Skill-Package/tree/master/skills/source/threejs-syntax/threejs-syntax-controls. TypingMind lee su archivo SKILL.md, empaqueta sus archivos y la instala como una habilidad que puedes activar en cada chat.

¿Qué modelos de IA pueden usar Threejs Syntax Controls?

Cualquier modelo que conectes en TypingMind. Las habilidades de IA son instrucciones en Markdown, no código específico de un proveedor, por lo que GPT, Claude, Gemini, Grok y los modelos locales pueden cargar esta habilidad cuando una solicitud se corresponda con ella.

¿Con cuántos modelos de IA puedo usar Threejs Syntax Controls?

Con tantos como quieras. Siempre que un modelo admita habilidades, puedes usar Threejs Syntax Controls con él: GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama y muchos más, todos en TypingMind con tus propias claves API.

¿Es gratuita la habilidad de IA Threejs Syntax Controls?

Sí. Impertio-Studio la ha publicado en GitHub bajo la licencia MIT. Solo pagas a tu proveedor de IA por los tokens que utilizas.

¿Qué son las habilidades de IA?

Una habilidad de IA es un conjunto de instrucciones reutilizables que enseña a un modelo de IA a realizar una tarea concreta. Sigue el formato abierto Agent Skills: un archivo SKILL.md con un nombre y una descripción, además de los scripts, plantillas o archivos de referencia que pueda necesitar el modelo. El modelo solo lee las instrucciones cuando tu solicitud se corresponde con la habilidad, por lo que una habilidad instalada no supone ningún coste hasta que se utiliza.

¿En qué se diferencian las habilidades de IA de los plugins o los servidores MCP?

Un plugin o un servidor MCP proporciona al modelo nuevas herramientas que puede invocar: código que se ejecuta en algún lugar y devuelve un resultado. En cambio, una habilidad de IA aporta conocimientos y procedimientos al modelo: cómo abordar una tarea, qué pasos seguir y qué se considera un buen resultado. Las habilidades son instrucciones en Markdown, por lo que no necesitan servidor, clave API ni entorno de ejecución, y funcionan con cualquier modelo.

Ver todos

Crea ya tu propio espacio de trabajo IA

Suscríbete a nuestro boletín para recibir avisos sobre nuevas funciones y próximos sorteos 👇