- Home /
How to use NavMeshAgent for space ship in 3D?
Hi. In space there is no floor or some flat surface, so when I try to bake NavMesh and hit play, I gain error: "Failed to create agent because it is not close enough to the NavMesh". Is it possible to use NavMeshAgent in such games (space or underwater) or I should write my own path-finding?
Answer by hugodeheld · Feb 21, 2018 at 11:56 AM
Navmesh is only for walking allong meshes. So yes, you are gonna have to write your own ai.
Answer by tormentoarmagedoom · Feb 21, 2018 at 12:03 PM
I had a "similar" problem.
What i did was, (lets see the ocean example).
I made the ocean ground the navmesharea, and the navmeshagents was walking on the ground. As the navmeshagent component will be always touching the ground, while changing its offset height while running to make objects "move in 3D".
The only problem is that 2 objects will never be one over the other, cause navmeshagents should be in same position
Hi, I'm stuck with this problem rn. I'm super begginer lvl, this is my second Unity project. I have bots moving towards player, I wanted them to slighty flow in Y exis. I've added C# code for floating, but when they run simultaneously navigation is bugging (bots are not moving towards the target, or they move somewhere else when I change floating parameters).
I would appreciate sharing your code for this. Or any help.
Thanks!
Answer by Skelly1983 · Aug 03, 2018 at 06:01 PM
The way I have gone about this issue for my game which is also in space, is to use plane mesh with a a transparent material.
Then I was able to bake my navmesh to this mesh. Transparent ramps was used to link different levels of planes for planets in a lower orbit.
Planets/Stars etc have a navmesh obstacle set to them and spaceships set to a navmesh agent.
Your answer
Follow this Question
Related Questions
NavMesh problem it does not respond corectly 0 Answers
My characther turning the wrong way when walking using Nav Mesh Agent 0 Answers
line in navmesh obstacle 1 Answer
NavMeshAgent wait for rotation before moving 1 Answer
Making NavMesh areas? 0 Answers