- Home /
NavMesh on collision dectection activate,On collision activate navMesh
Hello,
Im trying to do that AI is in cover(house) and when i shoot at his car he comes out of the house.
I've tried doing it with NavMesh so when bullet collides with object, navmesh sets destination to outside but it doesnt work, anyone could help me?,Hello,
I'm creating a game, i want to do that AI is in cover(house) but when i shoot at his car, he comes out to check. I've tried doing it with nav mesh, when bullet collides with object, set navmesh destination but it doesn't work. Anyone could help me with it? Thanks!
This is doable very easily, but please post your code to see where the problem could lie.
In general, I would add a collider onto the AI (or the house), and a script would detect in OnCollisionEnter() or OnTriggerEnter() if it was hit by a bullet, which then notifies the Nav$$anonymous$$eshAgent (possibly in a different script) to become active, and set a destination for it.