Bone with Len Modifier + 0 Position Bone Effect reverts to Baseline
OrangeSpork opened this issue · 0 comments
If a bone with an active length modifier also has a bone effect with a position modifier of 0,0,0 sent to it, it reverts to baseline instead of reverting to the length modified position.
A sample replication involves adding a length modifier to any of the bones affected by breathing (except the neck*) and turn on the breathing effect in AdvIKPlugin. At the bottom of each cycle when it calcs to 0 position modification the bone will snap to default for that frame and then snap back as the next frame applies a small position effect again.
I'm possibly (likely?) wrong but I think the issue is lines 146 to 150 of BoneModifier.cs are incorrect as it overwrites the length modifier with the position baseline which causes this and I think is unnecessary? But it's very likely I'm missing the scenario that's supposed to be addressing as I'm not fully following all the reset to baseline scenarios.
At least commenting this part of BoneModifier.cs out appears to fix things for me and doesn't seem to cause other issues.
{
BoneTransform.localPosition = new Vector3(
BoneTransform.localPosition.x + modifier.PositionModifier.x,
BoneTransform.localPosition.y + modifier.PositionModifier.y,
BoneTransform.localPosition.z + modifier.PositionModifier.z
);
_changedPosition = true;
}
// else if (_changedPosition)
// {
// BoneTransform.localPosition = _posBaseline;
// _changedPosition = false;
// }```
* - I thought this was just something weird with the neck as that was the initially reported case, so I changed that to a 0.01 y position min instead of 0 and didn't dig deeper until someone reported the same issue with a spine length modified character and I did some more looking.