Counting up the angle in degrees


I have an issue with measuring the angle of an object.

In the enclosed example-blend I have a script to determine the objects angle.
The problem with it, is that the angle only goes from 0 - 180 and then counts down again.

I would need the angle to be 0 at start and then count up. so after half rotation it should be 180, whole rotation 360, two rotations 720 etc.

I’ve tried different scripts from the forum but none was working properly. The one I am using is the closest I could find.

angle-issue.blend (464 KB)

Any suggestions for this?

Thanks for help!


for what I know

import math
import GameLogic as logic
from math import sqrt
import mathutils as mt

cont = logic.getCurrentController()
board = cont.owner

#Your orientation
angVel = board.getAngularVelocity(False)
board["angle"] =  board["angle"] + angVel.z

This should do some, but unfortunately it doesn’t support decimals (I was wrong), so you need to rotate the object fast in order to add the rotation value

Thanks, your approach is very close…
But when rotating slow, the rotation isn’t recorded.
That means it isn’t very accurate.

With the rotation via torque while the rest rotation of the dampening isn’t recorded, so if I’m trying to spin 180° it just displays around 90°

It does work however when I keep rotating…

EDIT: Sorry, when I set the property to float it seems to be pretty accurate

soo… I changed the value to float and yeah… did that worked as you expected?

yes, it did, thanks a lot!

But this only works for dynamic force rotations right?
If I change the angle through the regular Rot it seems that the script doesn’t work.

try this file. it should work fine for what ur using it for. I have a few files where i mess with this. My mario game was a headache fixing.


angle-fix.blend (464 KB)