transform rotate error

***I’m making simple Tank Games
I was setted Input setting to move Tank gun (right : q , left : e)
it’s supposed to move on tank body place but it’s not
as you see it’s just circling ***

what’s the problem ?

#pragma strict
var speed =5;
var rotSpeed = 120;
var turret : GameObject;

var power=600;
var bullet : Transform;

function Start () {

function Update () {

var toMove = speed*Time.deltaTime;
var toRot = rotSpeed*Time.deltaTime;
var front = Input.GetAxis("Vertical");
var ang = Input.GetAxis("Horizontal");
var ang2 = Input.GetAxis("MyTank");




As an educated guess, it is an issue due to having non-uniform scaling in your objects. To fix:

  • Take the tank apart so you don’t have any parent/child relationships.
  • If necessary, rotate any objects so that their front side is facing positive ‘z’.
  • Get the the editor script for RotateMesh and save it in RotateMesh.cs in the Assets/Editor directory.
  • Select object and do Window/RotateMesh. This will produce a clone of each object where the local scale is (1,1,1).
  • Reassemble your tank out of the cloned parts
  • Delete the original game objects