compass rotation

Hallo,

I wrote two scripts for a rotating compass. One to read the MainCameraRotation and one to give the rotation to the compass.
The problem I have is that the compass keeps rotating with the value it is getting and not standing still on that rotaionangle.
Any solution ?

Achim

script 1

static var kompassausrichtung;


function Update(){

 kompassausrichtung = transform.rotation.y ;
	
}

script 2

function Update(){
	
	transform.Rotate(0,0,kompassorig.kompassausrichtung);
	
}

129595--4825--$compass_455.png

I found the solution:

I had to replace the ´transform.Rotate´ with ´transform.localEulerAngles´
Now it keeps the angle from the MainCamera.
Thanks for reading

Achim