Rotate Z axes

Hi everybody,

I’ve got a tank, and I’m a noob in scripting. So I want to rotate the head of the tank about the Z axes. But it’s more difficult than I thought. Can anyone help me?

I can work with C# and Javascript, so doesn’t matter if you come with difficult explanations, I know most of the time what you mean…

mr32 :sunglasses:

tankHead.transform.Rotate( 0, 0, amount * Time.deltaTime );

goes in Update/LateUpdate.

And how can I let the ‘head’ react on the mouse (horizontal)?

You can use Input.GetAxis using “Mouse X” as the axis to get the amount the mouse has moved over the last frame. This value is in pixels, so you will probably need to scale it to get the right movement:-

var scaling: float;
  ...

tankHead.transform.Rotate( 0, 0, Input.GetAxis("Mouse X") * scaling);