Imagine Unity3D Island Demo.
Imagine you have a buggy running there, and you are the driver.
How can I create a script to make the buggy jump out the water and come to dry ground?
Like if I want to avoid buggy to go to inside water.
I’ve made a plane under the water level to detect the collision with the buggy. But how can I dinamically find the spot on dry ground to put the buggy after the collision?
Any idea?
Thanks.
Dynamically choosing where to replace the buggy could be very difficult. It’s much easier to add restart points to your scene. You can do this by placing empty GameObjects at convenient positions around the island as markers. Choosing where to restart the buggy is then just a matter of finding the nearest restart point. You might want to use the data structure in this thread to store and search through the points if there are a lot of them.
How about tracking the buggy’s position and return it back go where it was few seconds ago?
It could be a problem when your buggy was up in the air for some time and maybe already over the water but you could check for that separately.