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:
- Select an avatar with JiggleRig components in the scene
- Rotate the root transform
- 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
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:
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