- Home /
Collider2D.Cast() Visualization ?
Hi There,
I searched around the internet and I was not able to find the answer to this one, if it is even possible.
I am using Collider2D.Cast() in a project and I want to know if it's possible to "Draw" it in the scene view to know where exactly it is cast, similar to Debug.DrawLine or Debug.DrawRay.
I have tried multiple ways already with those two methods and so far, I can't get them to work since I need the initial position and the documentation on Collider2D.Cast() just says it cast the shape of the collider at it's position... so if I have this :

The code comes from an online course but does it mean it will cast a collider in the specified direction for the specified distance starting where the collider appears in the scene so if the distance is 2 and direction is right, it's going to be 2 "collider's length" away from the origin to the right ?
In order to draw it, I would need 2 debug statements with the origin of the draw line at the top right and bottom right corner ? Which I have no idea how to do since the Collider2D.bounds.extents property only return half the value of Collider2D.size.x or Collider2D.size.y
Your answer