GameObject rotates around global X axis instead of local

I use this code to rotate my GameObject:

 transform.RotateAround(new Vector3(0, 1, 0), horizontalAngle);
 transform.RotateAround(new Vector3(1, 0, 0), -verticalAngle);

Rotation around Y is OK, but around X not - it rotates around global axis. If I change methods to RotateAroundLocal, it still rotates around global X axis. What’s wrong?

Take a look at this answer
That should be what you need :slight_smile:

If you are rotating around the x axis, and not the y axis as you request, change the line in that script I linked to above,

from

verticalaxis = transform.TransformDirection(Vector3.up);

to

verticalaxis = transform.TransformDirection(Vector3.right);

use

Space.Self