- Home /
Answer by hvilela · Sep 30, 2012 at 08:00 PM
Yes, Raycasts only "collide" with colliders.
You can add a collider to your player and mark it as trigger, so it won't be affected by physics.
Answer by Owen-Reynolds · Oct 01, 2012 at 12:58 AM
You can use an "opposite" ray cast. `Camera.WorldToScreenPoint(transform.position)` will give you the pixel location of your player on the screen. You can then compare to raw mouse pos for however far away you want, in pixels (or can use 0-1 ViewPorts coords and check using screen%.)
The trick only works if you have a few things you want to check, like only the player in your case. Because you have to convert each one to screen coords (whereas a rayCast converts the mouse coords to world once and using the fast collision system to check.)
Your answer
Follow this Question
Related Questions
Need coding help with fps 0 Answers
Beginner to raycasting: making a gun 1 Answer
Raycast help 1 Answer
Hit distance Change light range 1 Answer
How can I make a gun shoot raycast by rounds per minute(RPM)? Making a FPS controller and need help! 0 Answers