- Home /
Avatar walk to position
Hi all,
I have some set of x and z coordinates in the database. For example (-13.5039 32.1832;86.1459 -11.9861;-72.642 -20.197;-15.3964 29.6977). I am trying to make the avatar move and animate to each of this position when the game start. I am trying to use the WalkFWD animation from the raw mocap file. My current code is shown below
float xcoord_B6 = float.Parse(reader_B6["xcoord"].ToString());
xcoord_B6 = xcoord_B6 / 10;
float ycoord_B6 = float.Parse(reader_B6["ycoord"].ToString());
ycoord_B6 = ycoord_B6 / 10;
Vector3 movement_B6 = new Vector3(xcoord_B6, 0, ycoord_B6);
avatar1.transform.rotation = Quaternion.LookRotation(movement_B6);
avatar1.transform.Translate(movement_B6 * 0.01f *Time.deltaTime, Space.World);
old_track_B6 = track_B6;
animator_B6.Play("WalkFWD");
Thank you
This all seems like something you could be doing with a PlayableDirector. Have you tried looking into that?
I haven't checked that. $$anonymous$$aybe I will start there. Do you think Unity Documentation is a good start?
Documentation is good when you're looking for one thing, but tutorials are better if you have no idea where to start.
@Rshields, I checked the PlayableDirector. It will not work in my case because the coordinates are not permanent. There is a program that keeps populating the coordinates that are stored in the database. The avatar is meant to respond to each coordinate change. I hope this makes sense. Thank you
Your answer
![](https://koobas.hobune.stream/wayback/20220612172827im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Copy the state of one animator to another 0 Answers
transform.forward doesn't work in my code 3 Answers
Animation always changing object position 1 Answer
Camera rotation around player while following. 6 Answers
Animation finish completely? 3 Answers