Command Palette

Search for a command to run...

UnylyUnyly
Назад к скиллам

vrm-springbone-physics

БесплатноБез исполняемых скриптовНе проверен

Debugging and fixing VRM SpringBone physics issues in three-vrm, including hair/clothing physics that flies upward, sticks out horizontally, or behaves…

Project-N-E-K-Oот Project-N-E-K-O★ 3 303 звезды на GitHub16 установок в других каталогах

Об этом скилле

VRM SpringBone Physics Debugging

This skill covers common issues with VRM hair/clothing physics using @pixiv/three-vrm and how to fix them.

How This Repository Does It (read first)

Collider and joint tuning goes through static/vrm/vrm-physics-profile.js, called from VRMManager._applyPhysicsProfile() in static/vrm/vrm-manager.js:

  • With a usable static/vrm/configs/{model}_physics.json (served by GET /api/model/vrm/physics_profile/{model}), matched colliders get the profile radius and matched joints get the profile settings.
  • Otherwise every collider falls back to VrmPhysicsProfile.DEFAULT_REDUCTION (0.5). The repository ships no profile, so this is what users see today.

When one model's hair looks wrong, write a profile for that model instead of changing the global factor or adding another reduction pass. The file format, matching rules, known limitations, and the open questions before making this user-facing are in docs/frontend/vrm.md (section "Per-model physics profile").

Runtime fields the scaling code depends on; keep them consistent if you touch this area:

Field Meaning
collider._rawOriginalRadius Radius as imported from the VRM, recorded once
collider._originalRadius Baseline at scale 1 (profile radius, or raw × 0.5); setModelScale multiplies it by the scale
joint._originalHitRadius Set only for joints whose hit_radius came from a profile; only these joints scale hitRadius

The snippets below are general three-vrm background. Do not paste them into the app as-is: the app already applies the reduction and scaling once, and a second pass compounds them.

Common Symptoms

  1. Hair flies upward or explodes outward on load
  2. Hair sticks out horizontally like there's an invisible wall
  3. Hair is stiff and doesn't move naturally
  4. Physics works but starts from wrong position

Root Cause 1: Incorrect Delta Time (Most Common - 90%)

Problem

The vrm.update(delta) function expects delta in seconds, not milliseconds. If delta is too large, physics "explodes".

Diagnosis

// Add this to your animation loop
console.log('delta:', delta);
// Should be ~0.016 for 60fps, NOT 16 or larger!

Solution

// Correct implementation using THREE.Clock
const clock = new THREE.Clock();

function animate() {
    requestAnimationFrame(animate);
    
    let delta = clock.getDelta();
    // Clamp to prevent explosion on tab switch or lag
    delta = Math.min(delta, 0.05);  // Max 50ms
    
    if (vrm) {
        vrm.update(delta);
    }
    
    renderer.render(scene, camera);
}

Root Cause 2: SpringBone Colliders (Very Common)

Problem

VRM models have invisible spherical colliders (usually on head/body) that prevent hair from penetrating. Virtually ALL VRM models have oversized colliders, causing hair to appear stuck horizontally in mid-air.

Root Cause Analysis

Confirmed Facts

  1. UniVRM Export Bug Exists (#673):

    • When colliders are on scaled objects, the radius doesn't normalize with the mesh
    • Gizmo shows correct size in editor, but exported collider is larger
    • Issue documented with reproducible steps
  2. three-vrm Uses Radius Directly (source):

    const distance = length - objectRadius - this.radius;  // radius not scaled by world matrix
    
  3. UniVRM Officially Discourages Scaling (source):

    "We do not recommend using SpringBone and scaling together"

Empirical Observation

[!NOTE] 50% reduction fixes ALL tested models. The exact mathematical reason is uncertain - the export scaling could vary by model/tool. However, this factor works universally in practice.

Possible explanations:

  • VRoid Studio (most common VRM source) may use consistent internal scaling
  • The visual matching in Unity editor may systematically create ~2x overcorrection
  • Export normalization algorithms may have consistent behavior

Practical Approach

Since the exact cause varies, we provide an adjustable reduction factor with 50% as default.

Diagnosis

Check if only bangs are horizontal (collider issue) or all physics elements (gravity issue):

  • Only bangs horizontal → Head collider blocking them
  • All physics horizontal → Gravity direction wrong

Disable colliders to confirm:

const colliders = Array.from(springBoneManager.colliders || []);
colliders.forEach(c => {
    if (c.shape?.radius) c.shape.radius = 0;
});
// If hair now falls correctly, colliders were the issue

Solutions

Option 1: Reduce Collider Radii by 50% (Recommended - Compensates for export bug)

const REDUCTION_FACTOR = 0.5;  // Compensates for UniVRM export scaling bug
const c
Полный SKILL.md на GitHub

Установить vrm-springbone-physics в Claude Code и Claude Desktop

Зарегайся, чтобы установить скилл

Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.

  • Открой команду установки в одну строку
  • Сохраняй скиллы в синхронизируемую библиотеку
  • Уведомления, когда скиллы обновляются
Зарегаться бесплатноУ меня уже есть аккаунт

Разрешённые инструменты

Инструменты, которые скиллу разрешено вызывать.

Без ограничений — скилл может использовать любой инструмент.

FAQ

Что делает скилл vrm-springbone-physics?

Debugging and fixing VRM SpringBone physics issues in three-vrm, including hair/clothing physics that flies upward, sticks out horizontally, or behaves unnaturally.

Как установить скилл vrm-springbone-physics?

Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.

Скилл vrm-springbone-physics запускает скрипты?

Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.

Похожие скиллы

Сравнить vrm-springbone-physics с