Simple question regarding Transform.RotateAround()

Hi,

I have this simple piece of code:

`

void Update () {

	float oldAngle = this.transform.rotation.eulerAngles.z;

	this.transform.RotateAround(this.transform.forward, 3);

	float newAngle = this.transform.rotation.eulerAngles.z;

	Debug.Log(oldAngle + "|" + newAngle);

}

`

Can you tell me why the output is

`

0|171.8873

171.8873|343.7747

343.7747|155.662

(…)

`

instead of

`

0|3

3|6

6|9

(…)

`

I just don’t get it.
Thanks in advance.

95% of the time, you’ll use Transform.Rotate with only one of the slots filled in. for example, trans.rot(0, 5, 0) spins around y, like a top. trans.rot(0,0,5) spins around the forward axis, z, for windmill blades or something.

Using, for example, transform.Rotate(10,5,0) rotates 5 around y, then tilts 10 forwards around local x. That gives sort of a odd wobble, which you rarely want.

Transform.RotateAround is for those rare cases when you don’t want just a facing change (spin on Y) or lean (tilt on z) or tilt forwards (on x.) Say you are orbitting the center of a space station, using it’s facing to spin around. RotateAround could do that.

As far as the angles you’re getting with EulerAngle, they are semi-random. It stores the “real” angle using quaternions, and translates back when you ask.