Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Smooth Path Movement

Discussion in 'Scripting' started by RiokuTheSlayer, Feb 22, 2015.

  1. RiokuTheSlayer

    RiokuTheSlayer

    Joined:
    Aug 22, 2013
    Posts:
    356
    So, question about some Pathfinding stuff.

    I have a gameobject with a script attached to it that generates a path, using nodes, blah blah blah, using A*. I know the pathfinding itself works, I had it draw gizmos along the path.

    So, now that I have the path, I want to know how to make the gameobject move along the path at a constant speed, and when it reaches the destination, to create a new path.

    The path itself is a List of a custom class, Node, which contains simple things like the neighbors, X and Y in the grid space, and a vector2 and 3 for the world space .

    If you guys need any of the classes, just ask.
     
  2. fox4snce

    fox4snce

    Joined:
    Jan 25, 2014
    Posts:
    74
    What is the gameobject's speed reliant on currently?

    Why can't you just make the next node the target, aim torward the target and move forward at whatever normal speed is?
     
  3. RiokuTheSlayer

    RiokuTheSlayer

    Joined:
    Aug 22, 2013
    Posts:
    356
    I got it, thanks. Just a matter of trying enough times.
     
  4. fox4snce

    fox4snce

    Joined:
    Jan 25, 2014
    Posts:
    74
    I'm glad you figured it out