Quantcast
Channel: Questions in topic: "javascipt"
Viewing all articles
Browse latest Browse all 1875

Can not get my raycast to detect an object

$
0
0
So I have a raycast script attached to an empty game object I can see the Debug.DrawRay but when my player walks into it the debug.log does nothing here is my code: function Update () { Debug.DrawRay (transform.position, Vector3.forward * 10, Color.green); var hit : RaycastHit; if ( Physics.Raycast( transform.position, transform.forward, hit, 100.0 ) ) { if (hit.collider.tag == "Player") { Debug.Log("HIT!!!"); } } }

Viewing all articles
Browse latest Browse all 1875

Trending Articles



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