X/Y freeze rotation bug

I’ve seen a lot of people mention it so I thought I’d just add my fix to the pile.

I’ve added an extra method that’s run by update which sets the rocket’s rotation back to 0 for X and Y.

void RotationCorrection()
{
    gameObject.transform.eulerAngles = new Vector3(0, 0, gameObject.transform.eulerAngles.z);
}

It sets the transform to a new vector 3 made from 0, 0 (for X and Y) and sets the z to whatever z currently is.

Privacy & Terms