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

Raycast and drawray problems

$
0
0
Hello... Im making a FPS on C# and im having some problems with the Raycast. Vector3 fwd = direction.transform.position; RaycastHit hit; if (Physics.Raycast(fwd, transform.forward, out hit)) ; { Debug.DrawRay(fwd, transform.forward, Color.red, 5F); if (hit.transform.gameObject.tag == "Wall") { print("HITwall"); } if (hit.transform.gameObject.tag == "Enemy") { //print("HITenemy"); GameObject.FindWithTag("Enemy").GetComponent().DmgOn = true; } The draw should begin at the *direction* position (the *direction* is an empty gameobject attached to the gun), but its starting far away from it. ![Error][1] The red line is the draw from the *Debug.DrawRay*. Can someone help?? I dont know what to do. Tnks! [1]: http://i.imgur.com/3Z0D9.jpg

Viewing all articles
Browse latest Browse all 92

Latest Images

Trending Articles



Latest Images

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