- Home /
This question was
closed Jun 15, 2017 at 12:32 AM by
DJGhostViper.
Question by
DJGhostViper · May 21, 2017 at 11:36 PM ·
movementnavmeshagent
How to make a NavMeshAgent move off another gameobject below it?
I have a gameobject I can move around and place on the ground underneath a nav mesh agent. I want the nav mesh agent to physically move off the gameobject. How can I make the agent get off the gameobject and stop once its off the gameobject? (I dont want to use Navmesh obsticals or Areas from Navigation). Thanks!
Comment
Answer by Marshal_Alessi · May 22, 2017 at 01:29 PM
Just tell it to move.
NavMeshAgent ai;
void Start()
{
ai = GetComponent<NavMeshAgent>();
}
void Update()
{
//check if it's on the box(I suggest raycasting)
ai.SetDestination(Somepoint.transform.position);
}
Follow this Question
Related Questions
Root motion handled by script. How to still use root motion with disabled navmesh agent? 0 Answers
Can't get player to walk to object using NavMeshAgent 1 Answer
Need tips on agent movement 1 Answer
Navmesh Agent Path Not Updating 1 Answer
Best practice to make NavMeshAgent chase a moving target? 1 Answer