Facepunch / sbox-issues

175 stars 12 forks source link

[ModelDoc] AnimStartLoop unexpected/undesirable behavior with ExtractMotion #3439

Closed Grodbert closed 1 year ago

Grodbert commented 1 year ago

Describe the bug

When using both AnimStartLoop and ExtractMotion nodes, they yield the undesirable effect of first Offsetting the start of the animation, and then Extracting the motion, causing any "movement" animation to start offset

  1. Changing the order of the nodes doesn't do anything.
  2. Adding an AnimAlign is a good "workaround"

To Reproduce

  1. Create a model with an animation that moves the model around
  2. Extract its motion by adding "Extract Motion" to the simple animation
  3. Add an "AnimStartLoop" node and give it a high frame number (but not last frame)

I've left a "quick" repro file, just drop it in any project/addon's folder as is.

Expected behavior

The motion should be extracted first, and then AnimStartLoop should start the animation from the desired frame, allowing for quick editing of animations that do not match when blended. (aka the [supposedly] intended use of AnimStartLoop)

Media/Files

https://github.com/sboxgame/issues/assets/86626409/6039e75d-5eea-411e-92f9-5b7bbaf51407

repro.zip ^ Repro, in case needed

Additional context

I am not sure this is a bug, it seems to be the logical result of first applying the "AnimStartLoop", making the animation start offset, and then applying the "ExtractMotion", hence why the treadmill is offset.

Personally, I think the nodes should be applied the other way around, if possible (allowing you to easily fix any syncing errors in movement blends, which are very finicky to get right), since "AnimStartLoop" was likely made for this use, as its description is:

Resets the starting frame of a looping animation. This is useful when mixing multiple animations and the animations need to all run together in phase, but the source animations don't match.

So it wouldn't make sense for the 2 modifiers to conflict in such a way when they'd be commonly used together for this purpose.

Although, I leave the decision to any dev picking this, as using AnimAlign mostly fixes this, however, I assume this creates more chagrin than having it the other way around.

MaxLebled commented 1 year ago

Have you tried using this?

image

Grodbert commented 1 year ago

Have you tried using this?

image

It fixes it, that's amazing, insanely useful to know, thanks Max 👍 +rep

https://github.com/sboxgame/issues/assets/86626409/8f7a6818-f44e-447c-89bf-41a4f4592bef

MaxLebled commented 1 year ago

You're welcome 😀