GothicVRProject / GothicVR

Fan project recreating the classic Gothic I and II experience in VR.
GNU General Public License v3.0
24 stars 2 forks source link

Generate Root Motion #270

Closed JaXt0r closed 6 months ago

JaXt0r commented 7 months ago

We're currently using legacy animations, which don't support root motion out-of-the-box.

If we remove position from BIP01, the NPC walks in place.

Options to explore:

  1. Check if we can go with Animator. I forgot why it didn't work. But let's recheck as Animator can handle root motions. (https://discussions.unity.com/t/procedurally-generate-animationclip-at-runtime/131746/3)
  2. Remove the root position from NPC, store it in a component, and run it during update to ensure root motion is in sync with actual NPC animation.
JaXt0r commented 7 months ago

Idea #1 - Go with Animator. No, it's not possible:

image

image

image

JaXt0r commented 6 months ago

Done. It is "hacked" by:

  1. Using Update() to apply collider on Sphere with every frame (needed for collision detection)
  2. At the end of the animation, final BIP01 localPosition is applied to the parentGO.