- Home /
Finding any objects below or above object at ANY POINT?
I am making a 2d endless runner. I have already made my random terrain generation script. I want platforms to find if there is another platform above or below them at ANY point on the object when it is generated. How would this be possible?
Comment
Best Answer
Answer by Ashish Dwivedi · Feb 04, 2014 at 04:31 AM
Cast two ray from object one up and another down. So in this way you can find any object above or below to that object casting a ray. Here is the scripting reference:
Thanks, i didnt know what would be best in this situation:)
Note this solution will only find the object if it the object is above the center of the object (or wherever the ray is cast from). You'll have to do more if you want to find out if any part of one object is over another.