- Home /
2 raycasts on the fpwalker/camera
I am still working on the chest script, so you can't open it from too far away. I added a Debug.DrawRay(transform.position, transform.forward*2, Color.red); so I could see the ray, but for some reason, I see 2 rays on the FPS controller/Camera. Any thoughts?
In addition, when I try to run the game and switch to scene, I'm not able to move the controller around. How can that be remedied? Thanks!
It does it to it's child too. To be specific try:
Debug.DrawRay(gameObject.transform.position, gameObject.transform.forward 2, Color.red);*
if that doesnt work then go to the reference site.
@maroonrs False, using the property transform is perfectly fine here.
Just tried it. I had one ray going at a 45 degree angle pointing down and the other, much shorter shooting out straight. I increased the multiplier to 3 and it still says I'm too far away. Any other thoughts??
Should I delete the FirstPersonWalker and main camera and try again?
Answer by Berenger · May 11, 2012 at 03:37 PM
If you can see two rays, simultaneously, it means they are not the same or they would be hover each other. That means they are probably not called from a single line of code. try ctrl + shift + f to find all the occurences of DrawRay.
Just to be sure, such a function shouldn't be in anything GUI related.
It was in Update().
Thanks BTW. I searched for ray through the entire solution and could only find one line of my code. I found plenty of occurrences in other scripts, but most of them either aren't being used right now or are part of the standard assets.
Your answer
Follow this Question
Related Questions
ray transform.position goes wrong 1 Answer
Raycast Will Only Hit Target If Jumping Over Object Firing Raycast 1 Answer
Multiple Cars not working 1 Answer
Distribute terrain in zones 3 Answers
Bottom area of a 3D model? Raycast? 1 Answer