I need a way to initiate a raycast from the camera when the player uses the mouse. Kind of like a laser, only once per click. I was trying to get together a method using rigidbodies, but the collision was faulty, and it was too slow.
Answer by DaveA
Feb 23, 2011 at 02:40 AM
Take a look here: http://unity3d.com/support/documentation/ScriptReference/Camera.ScreenPointToRay.html
Code there sounds like what you need
Thanks, I got it working. No console errors.
Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.
The best place to ask and answer questions about development with Unity.
To help users navigate the site we have posted a site navigation guide.
If you are a new user, check out our FAQ for more information.
If you are a moderator, see our Moderator Guidelines page.
We are making improvements to UA, see the list of changes.
Answers and Comments
No one has followed this question yet.
Raycast to ignore collider ?
Raycasting with the origin of the ray coming from the cursor
Camera to aim at raycast
Raycast won't work after Camera transforms position. Please help!
Camera.main.ScreenPointToRay sometimes causing NullReferenceException