A
A
andwin2017-03-09 20:34:43
Game development
andwin, 2017-03-09 20:34:43

How to find out which object is under another?

How to find out which object is under another, so that you can change it (for example, delete it)?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
K
KickMicro, 2017-03-09
@romanbel

As an option, hang a raycast down script on the desired object, and watch the result (this is for the unit, but I think it is suitable for all engines). well, or just in each frame to process the comparison of the z axis of objects

P
Pparma, 2017-03-10
@Pparma

If there are not many objects, then you can use Vector2.Distance between the positions of objects, excluding the coordinates along the Y axis.
Rather, it would be better to calculate Vector2.sqrMagnitude - faster.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question