Z
Z
Zefirot2021-11-08 14:30:10
Unity
Zefirot, 2021-11-08 14:30:10

How to perform actions on the edges of the collider?

The bottom line is that there are two round objects with CircleCillider2D, one sends another one of the same round object only of a smaller size, in general, one circle sends a circle to another circle, what exactly is needed - It is
necessary that this transferred object starts from the border of the collider, that is, its center was on the border of the collider, and also when it reached another object, an action took place (that is, it flew) when it touched the border of the collider with its center.
How to calculate it?
(that is, start from the border of one collider and stop at the border of another collider)
61890a322ffd4634631011.jpeg
In fact, I only need to understand how to calculate these points A and B, the beginning and end of the path ...

Answer the question

In order to leave comments, you need to log in

1 answer(s)
G
GavriKos, 2021-11-08
@Zefirot

Well, with point B, in general, everything is simple - if the distance between the centers <= radius B, then the object has crossed the zone of collider B with its center.
The second task is generally solved in a similar way - you need to place the center at a distance equal to radius A and with the desired angle of rotation.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question