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?

Navmesh is only for walking allong meshes.
So yes, you are gonna have to write your own ai.

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

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.