Keeping Raycast Endpoints At Edge Of CircleCollider2D?

Hi,

I would like to send multiple Physics2D.Raycast()s from one game object towards another, but keep the raycast endpoints around the edge of a CircleCollider2D circumference depending on the positions of the game objects.

I hope this example is helpful:

Any help would be appreciated, thank you. :slight_smile:

How many raycasts do you want? It might make it laggy if itโ€™s too much

I quite like the idea in this post I just googled:

Not many, maybe a few more or a few less than is in the gif I posted above.

Not really what I had in mind, but I appreciate the help :). I would like the casts to stick to the edges of the CircleCollider2D instead of using a cone of rays.

So I guess more like Linecast, but the end positions of the lines arenโ€™t fixed to points around the circle. The end points need to move around the outside of the CircileCollider2D as to not intersect it, but always the width of the CircleCollider2D.

Well, you could so some mathematical calculations wit sin and cos if you have a radius and the center of the circle and then raycast to each point