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 to Unity Answers, check out our FAQ for more information.
Make sure to check out our Knowledge Base for commonly asked Unity questions.
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 ?
Unity C# - RaycastHit internal error?
Raycasting forward from screen perspective instead of game position.
Move in direction of mouse look
Camera to aim at raycast