rotation relative to world / starting position

Hi - I’m trying to rotate an object based on an iphone’s tilt in the x direction. I’ve got a kind of janky formula that calculates rotation amount (rotAmt) to have a min of -5 degrees, max of 5 degrees, or anything in between. But when I call the function that monitors the tilt of the device (monitorTilt), it seems to rotate the item relative to its previous position and not to the world space (or to its starting rotation of 0).

Here’s my code:

var dir : Vector3 = Vector3.zero;
	dir.x = Input.acceleration.x;
	rotAmt = -((dir.x*100)/2)/5; //get the degrees we will rotate the lighter around the y axis (in degrees);
	Debug.Log(rotVal);
	flamePlane.transform.Rotate(0,0,rotVal,Space.World);

What do I need to do to fix this?

I’m not able to read the code, but note !!

rotate DOES in fact rotate it from “where it is now!” Heh!

You want to do something more along the lines of setting the euler angles.

PS if you don’t know what the Apollo 11 crew said about gimbal lock, now’s the time to learn !