Y
Y
yraiv2022-02-13 22:15:26
Unity
yraiv, 2022-02-13 22:15:26

Why can a collider overlap another in 2d?

There are 2 colliders, the first hangs on the parent object, the second on the child. Sometimes the child collider is on top and catches the click, and sometimes the parent collider. How to make the parent one higher? I tried to use Order in layer, but apparently it's not right. How to solve this

Answer the question

In order to leave comments, you need to log in

1 answer(s)
G
GFX Data, 2022-02-14
@yraiv

You can get all Physics2D.GetRayIntersectionAll() colliders from the click point, extract the parent from the resulting list if there is, if not, return the child. It is better to filter by tags or something else, so as not to waste time searching for who is related to whom.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question