Question by
kevinrocks_786 · Jan 24, 2016 at 07:31 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 move forward (towards z), ignoring any rotations? 0 Answers
class issues with interacting with unity gameobjects (using c# server ) 0 Answers
How to create a drop down menu in editor inspector 0 Answers
How to override constructor when creating a new element in a list from the inspector. 0 Answers
,Unity Custom Inspector CreateInspectorGUI redraw on change 1 Answer