Gradually spin faster

Hello! Im trying to modify a rotation script to gradually make a spinning objects speed faster every couple seconds.

But cant seem to work it out…

#pragma strict

public var speed : float = 10f;


function Update ()
{
    transform.Rotate(Vector3.up, speed += 12 * Time.deltaTime);
}

Thanks for any help!

Brayden

I’m not a Javascript programmer but I reckon that your problem is that you’re trying to make an assignment in the midst of making a calculation.

function Update ()
{
    speed += 12*Time.deltaTime;
    transform.Rotate(Vector3.up, speed * Time.deltaTime);
}

This should make speed increase by 12 units per second.

try this.

function Update ()
{
transform.Rotate(new Vector3(0, speed += 12f , 0));
}