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 Follow Spline Path

Discussion in 'Animation' started by brettg19802, Apr 1, 2024.

  1. brettg19802

    brettg19802

    Joined:
    Mar 23, 2015
    Posts:
    3
    I've been looking for the answer to this for years. I'm looking for a solution for a GameObject to follow a spline that travels in multiple directions in Unity3D.

    I've tried Megafiers, but it's too clunky and the support docs are terrible.
    Alternatives? Maybe with particles along path?

    Here is an example how easily it is done in 3ds Max.
    How do I remake this in Unity3D?

    Spline Path Follow.gif

    View attachment 1394092
     
  2. Enkianthus

    Enkianthus

    Joined:
    Mar 28, 2022
    Posts:
    26
    You can use Unity spline or other spline tool in Asset Store;

    Splines typically provide methods to obtain the position and tangent along the spline from the start to the end, such as:


    public Vector3 EvaluatePosition(float t);
    public Vector3 EvaluateTangent<T>(T spline, float t) where T : ISpline;


    You can use a script to assign this information to the position and rotation of a game object. If it's a tool from the Unity Asset Store, there are usually pre-built components for this purpose.