- Home /
Question by
kevinrocks_786 · Jan 24, 2016 at 07:47 PM ·
c#unity5classnavigationpath
Programmmed Animation (making transform move to vectors with code)
So I made a "Path Class" and it's to give a transform a bunch of Vector3's and it has to go there one by one. I can easily do this in animation. (Making an object move around to certain points) I have no idea what to do though.
Here are my classes:
[System.Serializable]
public class Path : System.Object
{
public Vector3[] pathDirecions;
public Path (params Vector3[] directions)
{
this.pathDirecions = directions;
}
}
static class PathExtensions
{
public static void FollowPath (this Transform obj, Path _path, float speed)
{
}
}
What I have in mind is to use Vector3.MoveTowards() for each point in the Path.
Here is how I would like to call it.
public Transform Player;
public Path guide;
void Start ()
{
Player.FollowPath(guide, 5);
}
Comment
Your answer
Follow this Question
Related Questions
How to make a gameobject go to certain points without animation 2 Answers
Multiple Cars not working 1 Answer
Distribute terrain in zones 3 Answers
unity 2D with delay run and jump 0 Answers