I am really frustrated, so much so that I am going to ask this last question and walk away from the computer and wait. I'm trying to use raycasts to get the current mouse position at a click. For now, I'm instantiating an object as a debugger. Here's my code:
Now, when I play the game, when I click, it instantiates the object right at the camera's position. What am I doing wrong? Any and all help appreciated.
asked Mar 22, 2010 at 01:09 AM
You say to instantiate at transform.position, which is the camera's position (I'm assuming your script is attached to the camera). You need to create a RaycastHit variable and use the position where the raycast actually hits.
That will still use the camera's rotation; probably you want to use Quaternion.identity instead.
answered Mar 22, 2010 at 01:45 AM