I'm currently busy on a sort of FPS game, I've got a crosshair in the middle of the screen but I need help with the positioning of the crosshair. I want to shoot to the crosshair, I'm using a raycast to shoot. I could use tips and "tutorial" like answers. I set up a little mini script showing whats the main thing my gun is doing:
That's about it what I'm using the rest is just defining what the raycast hit.
Thanks in advance!
asked May 05 '12 at 12:57 PM
You'll probably want to use Camera.ScreenPointToRay(), passing in some useful data like the center of the screen, mouse cursor position, or so on.
You can see an example here: http://answers.unity3d.com/questions/23683/air-strike-shoot-aiming-at-cross-hairs-in-middle-o.html
Here's the script reference page: http://unity3d.com/support/documentation/ScriptReference/Camera.ScreenPointToRay