Skip to content

JiggleRig bone rotations persist after editor Undo, causing twisted roots #756

@Crimsom13

Description

@Crimsom13

Describe the bug?

When rotating an avatar's root transform in the editor and then undoing (Ctrl+Z), the bones controlled by JiggleRig
components remain in their twisted state instead of reverting.

Steps to Reproduce

Steps to reproduce:

  1. Select an avatar with JiggleRig components in the scene
  2. Rotate the root transform
  3. Ctrl+Z to undo

The expected behavior

xpected: All bone rotations revert to pre-rotation state
Actual: JiggleRig-controlled bones stay twisted. The more you rotate+undo, the worse it gets.

Screenshots

No response

Build Info

..

Log Files

..

Additional Context

Cause: The JiggleRig simulation caches point positions (position, lastPosition) internally. When Unity's undo system
reverts the root transform, these cached values still reflect the old rotation. The sim overwrites the bone transforms
every frame from its stale cache, so the undo'd rotations are immediately replaced with the twisted ones.

Suggested fix: Subscribe to Undo.undoRedoPerformed and reset the JiggleRig's internal point positions/lastPositions to
match the current (post-undo) rest pose. Relevant code: JiggleJobSimulate.cs ApplyPose method + point cache.

Also noted: JiggleTreeStructExtensions.cs:20-22 defines IsNormalized() but it's never called —
SanitizeOutput(quaternion) only checks NaN, never normalizes. Not the cause of this bug but could cause slow drift

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions