import bge
from bge import logic
from bge import logic
cont = logic.getCurrentController()
obj = cont.owner
rotation = obj.worldOrientation.to_euler()
print(rotation.x)
print(rotation.y)
print(rotation.z)
Here's my code (above), which works fine, but the console prints really long digits. I am trying to get an object to rotate according to another object's rotation by taking the objects rotation, comparing it to the other, and adding/subtraction to x, y, or z. The problem I have is that the rotations have decimals when they aren't supposed to (, or atleast I think). The object has 0, 0, 0 as its rotation when I go to the object panel, but if I add 10 degrees to z, the script will print a long number (10.01231234923) when I added 10 and only 10. The object is static. In other words, I dont need the small and specific value. How can I have it only print the whole number, i.e. without decimals? Thanks.
round()
? Soprint(round(rotation.x, 2))
where2
is the number of decimal places to leave? $\endgroup$