Goal: Agent at A reaches destination at B in the shortest route (which could involve transport)
Problem: If I just tell the agent using navmesh to go to B it will follow the dotted line which is very long and slow.
What I want: I’d like the agent to realise taking the boat is the fastest route and take the boat.
- A has destination to B
- A finds taking the boat is the fastest
- A goes to the boat station
- A waits in a queue
- Boat arrives and let’s on X amount of people where X is the number of free seats on the boat.
- A walks onto the boat to their free assigned seat (How to get an agent to walk on a boat because a boat isn’t static?)
- A rides the boat across the water
- A gets off the boat at the next station
- A walks to B to complete their journey
Any help/suggestions on how to tackle this problem or at least some of the steps?
Attached image to outline my problem.
1. Create a NavMeshLink between the boat stations (make you the area type has quite a big “weight”, otherwise, all your agents will want to take the boat)
2. Detect when the agent reaches the 1st boat station,
3. Define the positions of the queue in an array (struct of
bool to indicate free/occupied) and change the navmesh agent destination to the front-most free location
4. Pause the navmesh agent
5. When the boat arrives (using triggerfor instance), resume
X navMeshAgents and make them board (animation / navmesh)
6. Move the
N - X other agents to the frontmost queue position
7. Move the boat to 2nd boat station
8. Make the
X agents land on the Navmesh and set back their destination to their initial one (B)
For your problem mentionned on your 5th point, keep in mind that you can have navmesh surfaces baked using gameObjects in a layer which is not rendered by the camera.