Fix: Reset simulation state on clothes disable in OnSetClothesState #2
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "crmbz/KK_AnisotropicMorph:master"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Problem
When a clothing slot disables a bone modifier (via
OnSetClothesState),Activeis set tofalsebut the simulation history is not cleared.When the modifier is re-enabled (clothes removed/changed), the physics
simulation resumes from stale state — causing a visible snap/jump as the
bone tries to reconcile its current position with an outdated
_prevPosition,_prevVelocity,_prevRotationand_prevAngularVelocity.Fix
Call
OnChangeAnimator()andBoneModifierData.Clear()after settingActive = falsein
BoneModifier.cs.OnChangeAnimator()resets simulation history (position, rotation,velocity, angular velocity, scale accumulators),
BoneModifierData.Clear()clears staleABMX offsets that were still being applied while inactive.
Change
BoneModifier.cs, insideOnSetClothesState():Tested with breast and butt bones, clothes on/off and state cycling.
Reproduction
I'd call this plugin old and busted. A new iteration (with the same name) resides in https://github.com/obedientGolem/KoikPlugins. It's still WIP though.
I'll merge PR anyways though, because why not.