Rotating doesn't work correctly?

So i'm rotating a cylinder about the z axis with the following code:

var zRotation = 1.0;
    InvokeRepeating("repeatFunc", 0.1, 0.1);

function Update ()

function repeatFunc ()
    zRotation = zRotation + 10;
    transform.eulerAngles = Vector3(0, 0, zRotation);

Whats weird is the rotation is skewed. It doesn't rotate around the centre of the cylinder but instead a point quite far off so it looks weird and mucks up my collision detection. Does anyone have any idea why this is happening and how to fix it?


Give this script a shot:

var speed = 3;

function Update () {

It should do the trick for you. Good luck!

One simple workaround for wrong pivots is to create an empty GameObject where your pivot should be (and oriented like your pivot should be) and then parenting your object (in your case the cylinder) to it. Now you're able to correctly rotate the newly created GameObject (and thus your object parented to it) without any skewing or other strange problems.