Quantcast
Channel: Questions in topic: "loops"
Viewing all articles
Browse latest Browse all 184

How to create a square using Linecast & loops?

$
0
0
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); } }[

Viewing all articles
Browse latest Browse all 184

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>