Search Unity

  1. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice
  2. Unity is excited to announce that we will be collaborating with TheXPlace for a summer game jam from June 13 - June 19. Learn more.
    Dismiss Notice
  3. Dismiss Notice

Question Movement along the spline

Discussion in 'Timeline' started by nehvaleem, Jan 28, 2024.

  1. nehvaleem

    nehvaleem

    Joined:
    Dec 13, 2012
    Posts:
    445
    Hello,
    I am looking for some guidance on how I should approach implementing spline scrubber/movement.

    What I am trying to achieve is:

    I want my animated target to follow a spline based on a root motion delta position (I have a walk animation that moves my character forward thus I can obtain the delta position.

    I don't mind having a separate AnimationTrack present that will drive the actual animation and blending, etc. since it isn't straightforward to extend AnimationTrack and related classes.

    So my question is:
    - how should I set the position and rotation of the Animator's GameObject? (i can handle all the required calculations)
    - what should I do to allow this to be previewable as regular animations when working with the timeline?

    I would appreciate some info. I've searched the forums, the internet, existing opensource packages (https://github.com/fx-lange/unity-spline-scrubber), and paid assets (https://assetstore.unity.com/packages/tools/animation/b-spline-path-105412) and didn't found anything that will work correctly.
     
    fxlange likes this.
  2. fxlange

    fxlange

    Joined:
    Dec 20, 2016
    Posts:
    45
    Hi, I‘m the developer behind spline scrubber and just stumbled upon your post. It’s true that spline scrubber doesn’t support your approach. What it allows to do is the other way around:

    Instead of the root motion driving the movement on the spline you could use the speed/delta from spline+timeline to drive the animation (develop branch).

    I guess as long as root motion delta is ~constant it could be close enough.