# applyRotation values in degrees

Hi everyone,
I’ve worked on my project and came over this problem.

Question:
If the applyRotation function would be called one tick,what value would it need to rotate 180°?

My Case:
I’ve written an Spaceship controll script.In this Script, if the Ship is standing still, you can rotate the cam. around the ship and if you are moving the ship, it automaticly moves the camera to its original angle.But if the Player rotated a few times around the ship the script would rotate all the made rotations back around, so it should cut of at a 180° and substrack 360° to get the shortest way back to its orginal Point.

``````
if own["speed"] == 0:
if G.mouse.position[0]-0.5 &lt; -.1:
CameraEmpty.applyRotation((0,0,(G.mouse.position[0]-0.4)*0.2*-1*0.5),True)
CameraEmpty["zoffset"] += (G.mouse.position[0]-0.4)*0.2*-1*0.5
elif G.mouse.position[0]-0.5 &gt; .1:
CameraEmpty.applyRotation((0,0,(G.mouse.position[0]-0.6)*0.2*-1*0.5),True)
CameraEmpty["zoffset"] += (G.mouse.position[0]-0.6)*0.2*-1*0.5

elif own["speed"] &lt; 2:
if CameraEmpty["zoffset"] &gt; 0:
while CameraEmpty["zoffset"] &gt; 3.125:   #Here it should look for 180°
CameraEmpty["zoffset"] -=3.125*2     #and substrackt 360°
elif CameraEmpty["zoffset"] &lt; 0:
while CameraEmpty["zoffset"] &lt; -3.125:
CameraEmpty["zoffset"] +=3.125*2

if CameraEmpty["zoffset"] != 0:
CameraEmpty.applyRotation((0,0,CameraEmpty["zoffset"]*-0.04),True)
CameraEmpty["zoffset"] += CameraEmpty["zoffset"]*(-0.04)

``````

VectX=own.getVectTo(object or point in space)
own.alignAxisToVect(VectX[1],axis,0 to 1)
Will align over time 1 is instant and 0 is not rotating at all.

Thank you very much.
This isn’t just easier but also shorter.

Its in radians, so 180 degrees is pi (3.14159)

The math module provides a radians() function to convert from degrees to radians. You can get the current frame rate from bge.logic.getAverageFrameRate(), (or getLogicTicRate if you want to get the fixed timestep used for simulation).

Dividing the rotation value by the tick rate will give you a delta rotation per tick if you want to ensure that the rotation occurs independently from the framerate.

VectX=own.getVectTo(object or point in space)
own.alignAxisToVect(VectX[1],axis,0 to 1)
Will align over time 1 is instant and 0 is not rotating at all.

Thank you all!