Quantcast
Channel: Answers by "khenkel"
Viewing all articles
Browse latest Browse all 47

Answer by khenkel

$
0
0
There can be a few reasons why your Raycast "doesn't seem to work". I don't know what exactly doesn't work, so I'll provide some ideas: - First of all, Physics.Raycast returns a bool, so you might want to poll it directly (" if(Physics.Raycast(transform.position, Vector3.left, out hit, 0.01f)") instead of doing it by saving it temporarily. The "hit" variable will then contain everything you need about your Raycast. - The distance seems to be very short. Keep in mind that the raycast is sent from transform.position, which means **the origin** of your object. For testing try out "Mathf.Infinity" instead. - You're sending it in the Vector3.left direction, which is **absolute**, it will always be the same direction. If you want it to be relative to your object, use "this.transform.left" instead. (correct me if I'm wrong here) **EDIT:** Whoops, "this.transform.left" doesn't exist. Then use "-(this.transform.right)". :)

Viewing all articles
Browse latest Browse all 47

Trending Articles



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