Skip to content

Add rotation constraints to prevent finger hyperextension in simplified hand rigs#78

Closed
Copilot wants to merge 3 commits intomainfrom
copilot/research-fingers-bending-issue
Closed

Add rotation constraints to prevent finger hyperextension in simplified hand rigs#78
Copilot wants to merge 3 commits intomainfrom
copilot/research-fingers-bending-issue

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Dec 8, 2025

Animations designed for full 5-finger skeletons cause unnatural backward bending when applied to simplified hand models (2-3 bones). This occurs because the source animations lack anatomical constraints.

Changes

Animation constraint system (AnimationUtility.ts):

  • New apply_finger_rotation_constraints() processes finger bone quaternion tracks
  • Converts to Euler angles, applies anatomical limits, converts back:
    • X-axis: -0.2 to 1.8 rad (prevents hyperextension)
    • Y-axis: ±0.5 rad (lateral movement)
    • Z-axis: ±0.3 rad (axial rotation)

Integration points:

  • AnimationLoader.ts: Applied during initial GLTF load
  • StepAnimationsListing.ts: Applied when animations rebuild (mirroring, warping)
// Process each finger bone track
const euler = new Euler()
euler.setFromQuaternion(quat, 'XYZ')

// Clamp to prevent hyperextension
euler.x = Math.max(euler.x, -0.2)  
euler.x = Math.min(euler.x, 1.8)
euler.y = Math.max(euler.y, -0.5)
euler.y = Math.min(euler.y, 0.5)

constrained_quat.setFromEuler(euler)

The constraint values are based on typical finger joint ROM. Post-processing approach avoids runtime overhead and works universally across skeleton configurations.

Original prompt

Research this issue and see if there are any causes for fingers bending backward. #37


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Co-authored-by: scottpetrovic <2573552+scottpetrovic@users.noreply.github.com>
@cloudflare-workers-and-pages
Copy link
Copy Markdown

cloudflare-workers-and-pages Bot commented Dec 8, 2025

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Preview URL Updated (UTC)
✅ Deployment successful!
View logs
mesh2motion-app bc19e5e Commit Preview URL

Branch Preview URL
Dec 08 2025, 08:51 PM

Co-authored-by: scottpetrovic <2573552+scottpetrovic@users.noreply.github.com>
Copilot AI changed the title [WIP] Investigate causes for fingers bending backward Add rotation constraints to prevent finger hyperextension in simplified hand rigs Dec 8, 2025
Copilot AI requested a review from scottpetrovic December 8, 2025 21:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants