rotation assignment vs multiplication with Quaternion

Hi All,

I cant’t figure this one…

Say I have game object and I want to rotate it with the aid of Quaternion. Say that the quaternion named q. What is the difference between

transform.rotation = q;

and

transform.rotation *= q;

Thank u in advance

Lets say your current rotation is (0,45,0). And you create a rotation like this:

q = Quaternion.Euler(0,30,0);

If you do this:

transform.rotation = q;

Your rotation at the end will be (0,30,0). That is you are assigning an absolute rotation of 30 degrees around the ‘Y’ axis. But if you do this:

transform.rotation *= q;

which is equivalent to this:

transform.rotation = q * transform.rotation;

your rotation at the end will be (0,75,0)…essentially adding the two rotation together.