- Home /
Detect if an object is next to another?
I'm very very new to Unity, and I'm attempting to create a driving game where there is a car on an initial 500x500 square of terrain. I'd like to have it so that whenever a terrain is visible, up to four more of that exact terrain are generated on all four sides of the original terrain whose visibility is checked, if there is not already a terrain on that side. For instance, if there are two terrains right next to each other on, say, the x-axis. The car starts on the left terrain and drives so that the terrain on the right becomes visible. I'd like to have it so that terrain is generated above, below, and to the right of that terrain upon becoming visible, but not on the left because there is already terrain there. I need help figuring out how to detect if terrain already exists on any of the four sides. Sorry if that was confusing, I can clarify any parts if needed. Thanks!
Your answer
Follow this Question
Related Questions
how to identify near objects 1 Answer
How to use proximity detector to detect objects coming closer using C# script 1 Answer
Detecting moving direction 1 Answer
Preventing circles in dungeon generation? 0 Answers
Player Proximity Detection 1 Answer