Agent skill

threejs-objects

three.js scene graph objects: Object3D transforms and hierarchy, Group, Mesh, InstancedMesh, SkinnedMesh, BatchedMesh, LOD, Line/LineLoop/LineSegments, Points, Sprite, Bone, Skeleton, ClippingGroup; interaction via Raycaster, Layers masks, and EventDispatcher patterns. Use when building scene hierarchies, picking objects with Raycaster, or configuring instanced/skinned meshes; for pure vector math use threejs-math; for skeletal clips use threejs-animation.

Stars 254
Forks 41

Install this agent skill to your Project

npx add-skill https://github.com/partme-ai/full-stack-skills/tree/main/skills/threejs-skills/threejs-objects

SKILL.md

When to use this skill

ALWAYS use this skill when the user mentions:

  • Parent/child relationships, position/rotation/scale, matrixAutoUpdate, updateMatrixWorld
  • Choosing mesh types: static vs instanced vs skinned vs batched LOD
  • Picking: Raycaster.setFromCamera, intersectObjects, recursive flag, face/uv results
  • Layers: selective visibility for cameras/lights/objects

IMPORTANT: objects vs math

Need Skill
Scene graph + picking threejs-objects
Box/ray math only threejs-math

Trigger phrases include:

  • "Object3D", "InstancedMesh", "SkinnedMesh", "Raycaster", "layers"
  • "父子节点", "射线拾取", "图层"

How to use this skill

  1. Compose scenes with Group and transforms; minimize deep hierarchies where possible.
  2. Instancing — set per-instance matrices; understand count and frustum culling behavior.
  3. SkinnedMesh — bind skeleton; clips in threejs-animation; skinning material flags in threejs-materials.
  4. Picking — normalize device coords, set ray from camera, filter by layers, validate intersections are sorted by distance before processing.
  5. EventsEventDispatcher on custom objects; patterns only, not DOM frameworks.
  6. ClippingClippingGroup usage per docs when user needs sectional cuts.
  7. Dispose — call dispose() on geometries/materials/textures when removing objects permanently.

Example: Raycaster picking with validation

javascript
import * as THREE from 'three';

const raycaster = new THREE.Raycaster();
const pointer = new THREE.Vector2();

function onPointerMove(event) {
  // Normalize device coordinates (-1 to +1)
  pointer.x = (event.clientX / window.innerWidth) * 2 - 1;
  pointer.y = -(event.clientY / window.innerHeight) * 2 + 1;
}

function pick(camera, scene) {
  raycaster.setFromCamera(pointer, camera);
  const intersections = raycaster.intersectObjects(scene.children, true);

  // Validate: intersections are sorted by distance (nearest first)
  if (intersections.length > 0) {
    console.log('Nearest hit:', intersections[0].object.name,
                'at distance:', intersections[0].distance);
  }
  return intersections;
}

See examples/workflow-raycaster-pick.md.

Doc map (official)

Docs section Representative links
Core https://threejs.org/docs/Object3D.html
Objects https://threejs.org/docs/Mesh.html
Objects https://threejs.org/docs/InstancedMesh.html
Core https://threejs.org/docs/Raycaster.html

Scope

  • In scope: Object3D graph, renderable object types, raycasting, layers, dispatcher basics.
  • Out of scope: Physics engines; XR input mapping (threejs-webxr).

Common pitfalls and best practices

  • Forgetting updateMatrixWorld before world-space ray tests on moved objects.
  • Raycaster without layers set picks unintended objects—set masks consistently on camera and objects.
  • InstancedMesh raycast hits need per-instance handling—check docs for your version.

Documentation and version

Object3D, mesh types, Raycaster, and Layers are documented under Objects and Core in three.js docs. Behavior of picking and layers can shift slightly—link the exact page for the user’s three.js line.

Agent response checklist

When answering under this skill, prefer responses that:

  1. Link Object3D, Mesh, InstancedMesh, Raycaster, or Layers as needed.
  2. Pair skeletal animation with threejs-animation and skinned mesh setup.
  3. Route pure linear-algebra questions without a scene graph to threejs-math.
  4. Route XR input to threejs-webxr when sessions/controllers are involved.
  5. Mention dispose() for geometries/materials when removing objects permanently.

References

Keywords

English: object3d, mesh, instancedmesh, skinnedmesh, raycaster, layers, scene graph, three.js

中文: 场景图、Object3D、Mesh、实例化、骨骼网格、射线拾取、图层、three.js

Expand your agent's capabilities with these related and highly-rated skills.

partme-ai/full-stack-skills

ocrmypdf-batch

OCRmyPDF batch processing skill — process multiple PDFs, Docker automation, shell scripting, and CI/CD integration. Use when the user needs to OCR many PDFs, set up automated OCR pipelines, or integrate OCR into workflows.

254 41
Explore
partme-ai/full-stack-skills

ocrmypdf-optimize

OCRmyPDF optimization skill — compress PDFs, configure PDF/A output, JBIG2 encoding, and lossless optimization. Use when the user needs to reduce PDF file size, create archival PDF/A files, or optimize OCR output.

254 41
Explore
partme-ai/full-stack-skills

ocrmypdf-image

OCRmyPDF image processing skill — deskew, rotate, clean, despeckle, remove border from scanned documents. Use when the user needs to improve scanned PDF quality, fix skewed pages, remove noise, or clean up scanned documents before OCR.

254 41
Explore
partme-ai/full-stack-skills

ocrmypdf-api

OCRmyPDF Python API and plugin skill — use OCRmyPDF programmatically from Python, integrate with applications, and extend with plugins (EasyOCR, PaddleOCR, AppleOCR). Use when the user needs to call OCRmyPDF from Python code, build OCR pipelines, or use alternative OCR engines.

254 41
Explore
partme-ai/full-stack-skills

ocrmypdf

OCRmyPDF core skill — add searchable OCR text layer to scanned PDFs, convert images to searchable PDFs, support 100+ languages via Tesseract. Use when the user needs to OCR a PDF, make a scanned PDF searchable, or extract text from scanned documents.

254 41
Explore
partme-ai/full-stack-skills

svelte

Guides Svelte and SvelteKit development including reactive components, stores, transitions, lifecycle hooks, SSR, file-based routing, and deployment. Use when the user needs to build Svelte components, create SvelteKit applications, implement reactivity patterns, or configure Svelte with Vite.

254 41
Explore

Didn't find tool you were looking for?

Be as detailed as possible for better results