Skip to content

77 game-dev skills for AI coding agents — Godot, Unity, Unreal, Phaser, PixiJS, three.js, Bevy, pygame, LÖVE, Roblox. Portable SKILL.md Agent Skills (the format Anthropic launched as Claude Skills), with a router that loads the right skill for your engine and task. Runs in Claude Code, Cursor, Kiro, Codex, Copilot, Gemini CLI and more.

fix(threejs): update snippets to r186

Kiro Crewa8320b7337ce
diff --git a/skills/web-engines/threejs-gltf-loading/SKILL.md b/skills/web-engines/threejs-gltf-loading/SKILL.md
index 6092b4d..bde8a00 100644
--- a/skills/web-engines/threejs-gltf-loading/SKILL.md
+++ b/skills/web-engines/threejs-gltf-loading/SKILL.md
@@ -13,7 +13,7 @@ description: >
Load `.gltf`/`.glb` models and play their animations in three.js, including
compressed geometry (DRACO/Meshopt) and textures (KTX2). Patterns target
-**r184**; preserve an existing project's pinned release unless migration is requested.
+**r186**; preserve an existing project's pinned release unless migration is requested.
## When to use
@@ -73,7 +73,7 @@ import * as THREE from 'three';
import { GLTFLoader } from 'three/addons/loaders/GLTFLoader.js';
let mixer; // declare outside so the loop can see it
-const clock = new THREE.Clock();
+const timer = new THREE.Timer(); // THREE.Clock is deprecated since r183
new GLTFLoader().load('assets/character.glb', (gltf) => {
scene.add(gltf.scene);
@@ -83,8 +83,9 @@ new GLTFLoader().load('assets/character.glb', (gltf) => {
mixer.clipAction(clip).play();
});
-renderer.setAnimationLoop(() => {
- const dt = clock.getDelta();
+renderer.setAnimationLoop((time) => {
+ timer.update(time);
+ const dt = timer.getDelta();
if (mixer) mixer.update(dt); // advance the animation by real seconds
renderer.render(scene, camera);
});
@@ -117,7 +118,7 @@ import { DRACOLoader } from 'three/addons/loaders/DRACOLoader.js';
const draco = new DRACOLoader();
// Point at the decoder files you ship (or a pinned CDN copy of the same version).
-draco.setDecoderPath('https://cdn.jsdelivr.net/npm/[email protected]/examples/jsm/libs/draco/');
+draco.setDecoderPath('https://cdn.jsdelivr.net/npm/[email protected]/examples/jsm/libs/draco/');
const loader = new GLTFLoader();
loader.setDRACOLoader(draco);
@@ -133,8 +134,9 @@ new GLTFLoader().load('assets/car.glb', (gltf) => {
gltf.scene.traverse((node) => {
if (node.name.startsWith('Wheel')) wheels.push(node);
});
- renderer.setAnimationLoop(() => {
- const dt = clock.getDelta();
+ renderer.setAnimationLoop((time) => {
+ timer.update(time);
+ const dt = timer.getDelta();
for (const w of wheels) w.rotation.x += dt * 4;
renderer.render(scene, camera);
});
@@ -150,7 +152,8 @@ new GLTFLoader().load('assets/car.glb', (gltf) => {
- **`load` is async** → `gltf` only exists inside the callback; declare `mixer`/refs
outside and assign them in the callback, or use `await loader.loadAsync(url)`.
- **Animation never moves** → you didn't call `mixer.update(delta)` each frame, or you
- passed milliseconds instead of seconds (use `clock.getDelta()`), or you forgot
+ passed milliseconds instead of seconds (use `timer.getDelta()` after
+ `timer.update(time)`), or you forgot
`action.play()`.
- **DRACO/KTX2 model fails** → the decoder/transcoder path is wrong or version-
mismatched. `setDecoderPath`/`setTranscoderPath` must point at files matching your
diff --git a/skills/web-engines/threejs-gltf-loading/references/loaders-and-animation.md b/skills/web-engines/threejs-gltf-loading/references/loaders-and-animation.md
index 8504a69..6771b62 100644
--- a/skills/web-engines/threejs-gltf-loading/references/loaders-and-animation.md
+++ b/skills/web-engines/threejs-gltf-loading/references/loaders-and-animation.md
@@ -14,7 +14,7 @@ import { DRACOLoader } from 'three/addons/loaders/DRACOLoader.js';
import { KTX2Loader } from 'three/addons/loaders/KTX2Loader.js';
import { MeshoptDecoder } from 'three/addons/libs/meshopt_decoder.module.js';
-const VERSION = '0.184.0';
+const VERSION = '0.186.0';
const base = `https://cdn.jsdelivr.net/npm/three@${VERSION}/examples/jsm/libs/`;
const draco = new DRACOLoader().setDecoderPath(`${base}draco/`);
@@ -96,7 +96,9 @@ it draws them in one call.
`to.crossFadeFrom(from, duration, warp)`.
- Listen for completion: `mixer.addEventListener('finished', (e) => {...})`.
-Always advance with real time: `mixer.update(clock.getDelta())` inside the loop.
+Always advance with real time: call `timer.update(time)` then
+`mixer.update(timer.getDelta())` inside the loop (`THREE.Timer`; `Clock` is deprecated
+since r183).
## Exporter hygiene (Blender → glTF)
diff --git a/skills/web-engines/threejs-materials-lighting/SKILL.md b/skills/web-engines/threejs-materials-lighting/SKILL.md
index 201e0c2..fbd833a 100644
--- a/skills/web-engines/threejs-materials-lighting/SKILL.md
+++ b/skills/web-engines/threejs-materials-lighting/SKILL.md
@@ -13,8 +13,8 @@ description: >
# three.js Materials & Lighting
Make three.js surfaces look right: pick the correct material, light the scene,
-enable shadows, and add image-based lighting. Patterns target **r184**, verified
-against **r184** (lighting is physically based by default since r155).
+enable shadows, and add image-based lighting. Patterns target **r186**, verified
+against **r186** (lighting is physically based by default since r155).
## When to use
@@ -85,7 +85,7 @@ const logo = new THREE.MeshBasicMaterial({ map: tex, transparent: true });
```js
renderer.shadowMap.enabled = true;
-renderer.shadowMap.type = THREE.PCFSoftShadowMap; // softer edges
+renderer.shadowMap.type = THREE.PCFShadowMap; // soft by default since r182
const sun = new THREE.DirectionalLight(0xffffff, 3);
sun.position.set(8, 12, 6);
@@ -121,9 +121,9 @@ const brick = new THREE.MeshStandardMaterial({
### 5. Image-based lighting from an HDR environment
```js
-import { RGBELoader } from 'three/addons/loaders/RGBELoader.js';
+import { HDRLoader } from 'three/addons/loaders/HDRLoader.js'; // RGBELoader before r180
-new RGBELoader().load('assets/studio.hdr', (hdr) => {
+new HDRLoader().load('assets/studio.hdr', (hdr) => {
hdr.mapping = THREE.EquirectangularReflectionMapping;
scene.environment = hdr; // lights + reflects all PBR materials
scene.background = hdr; // optional: show it as the backdrop
diff --git a/skills/web-engines/threejs-materials-lighting/references/materials-lights-table.md b/skills/web-engines/threejs-materials-lighting/references/materials-lights-table.md
index 326ccc9..d54ed79 100644
--- a/skills/web-engines/threejs-materials-lighting/references/materials-lights-table.md
+++ b/skills/web-engines/threejs-materials-lighting/references/materials-lights-table.md
@@ -56,7 +56,9 @@ reduce `decay` if a lamp seems too dim.
Tuning knobs: `light.shadow.mapSize` (default 512×512; raise to 1024/2048 for
crisper edges at memory cost), `light.shadow.bias` (small negative to fix acne),
`light.shadow.normalBias`, and `renderer.shadowMap.type` (`BasicShadowMap`,
-`PCFShadowMap`, `PCFSoftShadowMap`, `VSMShadowMap`). Visualise the frustum with
+`PCFShadowMap`, `VSMShadowMap`). `PCFShadowMap` has been soft since r182, and
+`PCFSoftShadowMap` now just falls back to it with a console warning. Visualise the
+frustum with
`new THREE.CameraHelper(light.shadow.camera)`.
## Transparency & sorting
diff --git a/skills/web-engines/threejs-scene-setup/SKILL.md b/skills/web-engines/threejs-scene-setup/SKILL.md
index 7a615a3..ff3b7d2 100644
--- a/skills/web-engines/threejs-scene-setup/SKILL.md
+++ b/skills/web-engines/threejs-scene-setup/SKILL.md
@@ -13,7 +13,7 @@ description: >
Create the foundation of a three.js app: module loading, the
scene/camera/renderer trio, the render loop, responsive resizing, and camera
-controls. Patterns target **r184**. Read the installed `three` version before
+controls. Patterns target **r186**. Read the installed `three` version before
changing an existing project because examples and addons move across releases.
## When to use
@@ -39,7 +39,7 @@ changing an existing project because examples and addons move across releases.
lit material you also need a light (see `threejs-materials-lighting`).
4. **Drive a render loop with `renderer.setAnimationLoop(fn)`.** It's the modern,
WebXR-/WebGPU-safe replacement for hand-rolled `requestAnimationFrame`. Use a
- `Clock` for delta time.
+ `Timer` for delta time (`Clock` is deprecated since r183).
5. **Handle resize** so the camera aspect and renderer match the canvas; update
`camera.aspect`, call `updateProjectionMatrix()`, and `renderer.setSize(...)`.
6. **Add `OrbitControls`** for orbit/pan/zoom while developing. Confirm something
@@ -54,8 +54,8 @@ changing an existing project because examples and addons move across releases.
<script type="importmap">
{
"imports": {
- "three": "https://cdn.jsdelivr.net/npm/[email protected]/build/three.module.js",
- "three/addons/": "https://cdn.jsdelivr.net/npm/[email protected]/examples/jsm/"
+ "three": "https://cdn.jsdelivr.net/npm/[email protected]/build/three.module.js",
+ "three/addons/": "https://cdn.jsdelivr.net/npm/[email protected]/examples/jsm/"
}
}
</script>
@@ -95,13 +95,15 @@ const cube = new THREE.Mesh(
scene.add(cube);
```
-### 3. The render loop (setAnimationLoop + Clock)
+### 3. The render loop (setAnimationLoop + Timer)
```js
-const clock = new THREE.Clock();
+const timer = new THREE.Timer(); // replaces the deprecated THREE.Clock (r183+)
+timer.connect(document); // optional: no huge delta after a hidden tab
-renderer.setAnimationLoop(() => {
- const dt = clock.getDelta(); // seconds since last frame
+renderer.setAnimationLoop((time) => {
+ timer.update(time); // call once per frame, before getDelta()
+ const dt = timer.getDelta(); // seconds since last frame
cube.rotation.x += dt; // frame-rate independent
cube.rotation.y += dt * 0.7;
renderer.render(scene, camera);