- Home /
Question by
supremegrandruler · Oct 20, 2014 at 02:39 AM ·
c#loopssquare
How to create a square using Linecast & loops?
I'm trying to draw a square using loops but no success so far. This is one of my many attempts:
for (int i = 0; i < 1; i++) {
Vector2 start = new Vector2 (collider.bounds.min.x + (collider.bounds.size.x * i), collider.bounds.min.y);
for (int j = 0; j < 1; j++) {
Vector2 end = new Vector2 (collider.bounds.min.x, collider.bounds.min.y + (collider.bounds.size.y * j));
RaycastHit2D hit = Physics2D.Linecast (start, end, obstacleLayer);
Debug.DrawLine (start, end, Color.red, 10.0f);
}
}[
Comment
Your answer
Follow this Question
Related Questions
Multiple Cars not working 1 Answer
Distribute terrain in zones 3 Answers
loop through a renderer 1 Answer