Hello there!
I am using my own 3D models with animations and would like to move my enemies 90 degrees with each move they make.
I tried implementing some monstrous nested “if” statements and some transform.localRotation * Quaternion.Euler(0f, (numbers like 90f, 180f, 270f, lol), 0f) but none of it really worked. I got frustrated and deleted the monster, but I’m sure it wasn’t correct anyways… I would greatly appreciate it if one of you kind TAs or more experienced devs could shine a little light on the solution.
Currently, I have them programmed to “LookAt” the base (since the rotation was not working at all).
Ideally, I would like to have them face whatever direction they are moving in.
For location, I was thinking it would go in the FollowPath coroutine?
IEnumerator FollowPath(List<Waypoint> path)
{
print("Starting patrol");
foreach (Waypoint waypoint in path)
{
transform.position = waypoint.transform.position; //would add the code after this?
yield return new WaitForSeconds(dwellTime);
}
print("Ending patrol");
anim.SetInteger("condition", 1);
//transform.localRotation = transform.localRotation * Quaternion.Euler(0f,Random.Range(-60f,60f),0f);
}
Thank you so much in advance! I really appreciate the help.
Best,
Terra