Quantcast
Channel: Questions in topic: "drawray"
Viewing all articles
Browse latest Browse all 92

How can I draw a specific distance with Debug.Drawray

$
0
0
I have this issue: I'm using Physics2D.Raycast as next: RaycastHit2D hit_der = Physics2D.Raycast (transform.position+new Vector3(transform.localScale.x/2,0,0),Vector3.right,1,10); RaycastHit2D hit_izq = Physics2D.Raycast (transform.position-new Vector3(transform.localScale.x/2,0,0),Vector3.left,1,10); Where supposedly I have my distance of 1 and it'll be true if I hit my layer 10. Well, until here there is no problem, but now I want to see the rey with the next: Debug.DrawRay(transform.position+new Vector3(transform.localScale.x/2,0,0),Vector3.right); Debug.DrawRay(transform.position-new Vector3(0,transform.localScale.y/2,0),Vector3.left); The problem here is that DrawRay doesn't allow a distance parameter, how can I draw the distance declared in Raycast using Drawray? I've observed that if I multiply the parameter direction of Drawray, a bigger line is drawn, If I let just the direction without multipliers, is the same as my "1" distance in Raycast? Thank you.

Viewing all articles
Browse latest Browse all 92

Trending Articles



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