What i want to know is that is there a Way to Set your Tank turret to look in the direction of the Mouses hand/arrow? And can any one help me with a zoom thing so like when you press the z or + Or - it zooms in or out? if you can that will be great please and thank you.
That gets you the position in the world of a screen click or mouse position…
Rotates your transform so Transform.forward points at that point
For the turret follow you can use the transform.LookAt(yourtarget.transform)
function.
And for the zoom, you can just add a positive value to your camera transform if you want to zoom in, and a negative value if you want to zoom out.
Use Camera.ScreenToWorldPoint (Vector 3)
by making an empty object and set it right in the front of the tank’s gun and set it’s transform to = that Vector 3 like :-
target.transform.postion = Camera.ScreenToWorldPoint (Input.MousePostion);
Gun.gameObject.transfrom.LookAt (target.transfrom);
that’s all what I know
note :-
if one of your rotation isn’t 0 like : y = -90f, to make the gun look good on the tank, so don’t forget to do that :-
Gun.gameObject.transfrom.rotation = New Vector3 (0f, -90f, 0f);