To begin, here's my code:
import bge
from bge import logic
import random
from math import degrees
cont = logic.getCurrentController()
own = cont.owner
scene = bge.logic.getCurrentScene()
rotation = own.worldOrientation.to_euler()
rotation_x_round = round(degrees(rotation.x), 3)
rotation_y_round = round(degrees(rotation.y), 3)
rotation_z_round = round(degrees(rotation.z), 3)
own["x"] = rotation_x_round
own["y"] = rotation_y_round
own["z"] = rotation_z_round
own.rotation_euler = Euler((10, 10, 10), "XYZ")
I am trying to set the rotation of my object, not add rotation. In the code, own.rotation_euler
is what creates the error. It is telling me there is no attribute "rotation_euler," so I tried changing the line to the following: own.worldOrientation = (10, 10, 10)
. This one works; however, as I've assumed, it didn't rotate it correctly as it rotated the object to a number which seemed independent of my input. I have come up with my code from this question. Why does Blender's rotation_euler not work? Thanks!
Also, the .blend (that you can use as a start) can be found here.