Help with aiming

Hello,

here is my demo prototype
https://dl.dropbox.com/u/14167855/MechSmoke_004.html

The problem is that I cannot make proper aiming. I want ideally the model be facing the projection of the mouse position to the XZ plane (Y = 0). Right now I am doing vica-versa. I find screen position of the model and using atan2, calculate the angle alpha to make the model in the screenspace look at the mouse pointer. I use the same angle to rotate the model over global Y in worldspace. It does not work ok always.

Need some tip!

Cant help you but the game seems to be fucking funny (^.^)

ok, thanks for the bonus feedback :), though right now this is just WIP

freaking bump

I recommend you…

Take the mouse input position, and from it, use:

Camera.mainCamera.ScreenToWorldPoint()

(Where your Z input is a predefined Z-depth)

Then with the transform of your gun, use gunTransform.LookAt(thePositionYouGotUpThere);

That should handle it nicely.

-JFFM

Ok thanks, I used what you said as a starting point. But then I needed to correct Z-depth, because in my case it is not fixed. Was not too hard. Now things work well