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

Debug.DrawRay from camera

$
0
0
Hi. I'm fairly new to unity and have been on it for a couple weeks now. So I'm currently trying to draw a ray from my camera to wherever I click. I've got the ray barely working. I see the ray only in scene and not game mode. I've tried turning it on in gizmos, setting a time duration for the ray, and already put it in the update function but I still just can't see it in game. Only scene. Also when I run it, the ray is already there without me having to click on any point. Regardless of where I click, the ray doesn't change to where I click as well. Here's what I have so far: if(Input.GetButton("LMB")){ var ray = Camera.mainCamera.ScreenPointToRay(Input.mousePosition); Debug.DrawRay (ray.origin, ray.direction * 50000000, Color.red); } Would really appreciate if I could get some advice on this! Thanks!

Viewing all articles
Browse latest Browse all 92

Trending Articles



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