- Home /
This question was
closed Jun 26, 2018 at 10:29 PM by
Nostr0 for the following reason:
Answered on reddit https://www.reddit.com/r/Unity3D/comments/8t3nc4/tank_turret_rotation_problem/
Rotate tank turret to mouse position
I am new to Unity and I wanted to remake a game which I've seen on the Wii.
I basically want the transform of the turret to follow the mouse like in this Game.
This is my attempt which does not work as intended for some reason
// Make the Tank Turret look at the mouse (Y rotation only)
Vector3 m = Input.mousePosition;
m = cam.ScreenToWorldPoint (new Vector3 (m.x, m.y, 9.5f));
result.transform.LookAt (m);
At the moment I am using the tank asset from the Unity tutorial.
Comment