M
M
MishkaVNorky2019-08-14 10:20:08
C++ / C#
MishkaVNorky, 2019-08-14 10:20:08

Traffic, transport respawn, how best to do it?

Hello everyone, interested in all ways of implementation.
There is a city. There is traffic.
There are waypoints on all roads.
When the car goes far, it is transferred to the nearest point to the player.
The problem here is that another vehicle or character can stand at this point.
Now, before each transfer, at each point nearby, I have to throw from above, which is looking for colliders. But this is not optimal.
What other options are there?
I thought to do something like a grid and cells, like the machine knows that it is in cell number 5, but it didn’t work out adequately.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Ark Tarusov, 2019-08-16
@kreo_OL

Most likely, no one will give you specific implementation methods for free)
Of the options
- the field matrix (what you wrote.)
- An array of the machines themselves, you can go through it and find out if there is a car in the desired coordinate. Not very optimal, but better than raycast and colliders.
- An array of points with info about cars. Do you transfer a car to a specific point? when you move the car there and check there is something. For this to work, when the car is at this point, it marks it, when it leaves the point, the mark is removed.
- You can still try navmesh) they just will not stand on one point.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question