- Home /
Question by
csgeorge · Jan 03, 2017 at 11:17 PM ·
navmeshnavmeshagentnavigation
agent.SetDestination won't follow on different z-axis plane
I'm using agent.SetDestination to make my AI characters follow the player as they move. This works fine as long as they are on the same plane in the z-axis as the characters, but they will stop following whenever the player jumps up/down onto a different plane. Anyone know why this is the case and how to resolve it?
void Awake()
{
player = GameObject.FindGameObjectWithTag("Player").transform;
agent = GetComponent<UnityEngine.AI.NavMeshAgent>();
activated = false;
}
void FixedUpdate()
{
if(activated == true)
{
agent.SetDestination(player.position);
}
}
Comment
Your answer
![](https://koobas.hobune.stream/wayback/20220612104012im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Getting a navmeshagent back on a navmesh. 1 Answer
How do I get agents to avoid each other? 0 Answers
Navmesh y-axis 1 Answer
What is the difference between configuration of agent in 'Agents' tab and in 'Bake' tab Unity? 1 Answer
How to prevent NavMeshAgents from colliding when warped to same position? 0 Answers