|
I have cannon and aim dot. Aim dot should be even exactly in mouse cursor position. Cannon should look to aim. I don't know how to have aim right under mouse cursor. I don't know how to rotate cannon to look at aim. I have read some others question / answers about Raycast to object make looking on mouse position. But i cannot make it works. edit(moved from "answer") NOw i have this, and this works, but not like i want, i need aim to be right under mouse. Don't understand how to use World coordinates of mouse, when i try my aim gets right to camera coordinates. When i try viewport coordinates ScreenToViewportPoint, my aim not under mouse too. Please help me (((
(comments are locked)
|

I think you will get a lot of value studying the "Tower Defense Tutorials" found on Unity Cookie:
http://cgcookie.com/unity/2012/05/22/unity-tower-defense-tutorial-part-01-autoturret/
Have you tried anything from here?
http://unity3d.com/support/documentation/ScriptReference/Camera.ScreenToWorldPoint.html
Thanks. I cannot understand how to use Camera.ScreenToWorldPoint because when i try camera.ScreenToWorldPoint it's give me error. I don't use attaching camera to player or another object. it seems i have bad variable camera.
@Rantiev: Don't post an answer when you don't want to answer your question. Answers should answer the question!
I've converted your answer into a comment.
@Rantiev: Ok, once more:
This is not a forum! Inform yourself how Q&A sites work and read the FAQs.