threejs-impl-physics

threejs-impl-physics is a skill for Claude Code, Codex from Impertio-Studio/Three.js-Claude-Skill-Package. It costs 107 tokens per session (3,277 once invoked), scanned A, original, MIT.

A Three.js guide for adding physics simulation, where software calculates movement, collisions, and constraints between 3D bodies.

In plain words
What is it for?
Use it for rigid bodies, collisions, constraints, raycasting, and synchronising cannon-es or Rapier physics bodies with Three.js meshes.
Why use it?
It helps choose between the cannon-es and Rapier engines and prevents common integration errors such as skipping simulation steps or using the wrong vector format.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one. Also seen: mentions Claude Code.

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add skills/impertio-studio/three.js-claude-skill-package/threejs-impl-physics
Any agent
npx skills add Impertio-Studio/Three.js-Claude-Skill-Package --skill threejs-impl-physics
Clone the repo
git clone --depth 1 https://github.com/Impertio-Studio/Three.js-Claude-Skill-Package

Made for: Claude Code, Codex.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for threejs-impl-physics

README.md
[![agentmods](https://agentmods.dev/badge/skills/impertio-studio/three.js-claude-skill-package/threejs-impl-physics.svg)](https://agentmods.dev/skills/impertio-studio/three.js-claude-skill-package/threejs-impl-physics)
Your own site
<a href="https://agentmods.dev/skills/impertio-studio/three.js-claude-skill-package/threejs-impl-physics"><img src="https://agentmods.dev/badge/skills/impertio-studio/three.js-claude-skill-package/threejs-impl-physics.svg" alt="Measured on agentmods" height="20"></a>
Per session 107 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 3,277 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00107 $0.03277
Opus 5 $0.00053 $0.01639
Sonnet 5 $0.00021 $0.00655
Haiku 4.5 $0.00011 $0.00328

Measured 6d ago against content hash aac5193dad33, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-06, from the pricing page.

Security

Grade A, and why

threejs-impl-physics scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 6d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

skills/source/threejs-impl/threejs-impl-physics/SKILL.md · 397 lines

How it starts

The opening of the file, as written. The whole thing — 397 lines — stays where its author put it; the contents beside it link to each section on GitHub.

threejs-impl-physics

Quick Reference

Engine Selection Decision Tree

Criterion cannon-es Rapier
Scene size < 100 bodies 100–10,000+ bodies
Determinism needed No Yes (cross-platform)
CCD (fast objects) Limited Full support
Bundle size budget ~100 KB ~300–600 KB (WASM)
Initialization Synchronous Async (MUST await init())
Prototyping speed Faster (simpler API) Slower (builder pattern)
R3F integration @react-three/cannon @react-three/rapier

Rule: ALWAYS use Rapier for production applications requiring determinism, CCD, or > 100 bodies. Use cannon-es for prototyping and simple scenes.

Critical Warnings

NEVER forget to call world.step() in the animation loop — physics bodies will NOT move without it.

NEVER use mesh.position.copy(body.position) with Rapier — Rapier returns plain {x, y, z} objects, NOT CANNON.Vec3. ALWAYS use mesh.position.set(pos.x, pos.y, pos.z).

NEVER use Rapier APIs before await RAPIER.init() completes — ALL Rapier classes are undefined until WASM loads.

NEVER use Trimesh / trimesh colliders on dynamic bodies — triangle meshes are STATIC only in both engines. Use ConvexPolyhedron / convexHull for dynamic concave geometry.

NEVER create physics bodies without corresponding Three.js meshes unless intentionally creating invisible colliders — orphaned bodies waste simulation budget.


cannon-es

World Setup

import * as CANNON from 'cannon-es';

const world = new CANNON.World();
world.gravity.set(0, -9.82, 0);
world.broadphase = new CANNON.SAPBroadphase(world);
world.solver.iterations = 10;
world.allowSleep = true;

ALWAYS set world.allowSleep = true — sleeping bodies skip simulation and dramatically improve performance.

ALWAYS use SAPBroadphase for scenes with > 20 bodies. NaiveBroadphase is O(n^2).

Body Types

Type Mass Behavior
CANNON.Body.DYNAMIC > 0 Affected by forces and collisions
CANNON.Body.STATIC 0 Immovable, infinite mass
CANNON.Body.KINEMATIC 0 Moved programmatically, pushes dynamic bodies

Read the full file on GitHub · 397 lines

Files

What ships with it

4 files beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 6d ago First seen · 397 lines · 107 tokens per session scan A aac5193dad33

Subscribe to this mod's changes

threejs-impl-physics is a skill published in the GitHub repository Impertio-Studio/Three.js-Claude-Skill-Package (11 stars, last pushed 1mo ago), licensed MIT. It adds 107 tokens to every session and 3,277 once invoked, about $0.0005 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.

Related

Other skills, from other repositories

unreal-mcp

Automate Unreal Engine editor scenes, actors, and renders.

NousResearch/hermes-agent · 17 tokens

sceneview-web

Build 3D and WebXR (AR/VR) experiences in the browser with SceneView for Web — Filament.js (WebGL2/WASM) wrapped in a Kotlin/JS DSL and a plain-JavaScript API on window.sceneview. Use whenever the user asks for "3D in the browser", "a web model viewer", "WebXR AR/VR", or any browser 3D/AR app where the dependency is…

sceneview/sceneview · 147 tokens

sceneview

Build 3D and AR apps with the SceneView SDK in Jetpack Compose, SwiftUI (iOS/macOS/visionOS via SceneViewSwift), Web (Filament.js), Flutter and React Native. Use whenever the user asks for "3D in Compose", "AR with ARCore in Compose", a model viewer, or any cross-platform 3D/AR app where the dependency is…

sceneview/sceneview · 156 tokens

hz-unity-meta-mixed-reality-utility-kit

Meta XR Mixed Reality Utility Kit (MRUK) (com.meta.xr.mrutilitykit) for Unity XR development. Use when working with Scene API data (rooms, walls, floors, furniture), spawning prefabs on scene anchors, placing virtual objects in the real world, world locking to prevent anchor drift, raycasting against room geometry…

meta-quest/agentic-tools · 136 tokens

hz-vr-debug

Debugs Meta Quest and Horizon OS VR/MR applications using the metavr CLI — view logs, capture screenshots, diagnose common issues. Use when troubleshooting crashes, errors, or unexpected behavior on Quest devices.

meta-quest/agentic-tools · 46 tokens

reversing-unity-il2cpp

Reverse engineer Unity games and apps built with IL2CPP or Mono, using Il2CppDumper, Il2CppInspector, and dnSpy. Use when an APK or IPA contains global-metadata.dat, libil2cpp.so, UnityFramework, or Assembly-CSharp.dll, when jadx shows only UnityPlayerActivity, or when the target is described as a Unity build.

trilwu/secskills · 85 tokens