how do I find the angle of an dRot may?
type
angle = act.dRot
I’m pretty sure dRot uses radians, so you can just convert it to degrees for some easier reading.
use pi. use math.pi to be precise. if you want a 90 degree turn. use math.pi/2 and then just mess with that.
Solved!!
import GameLogic as gl
import Mathutils
# get the controller
controller = gl.getCurrentController()
scene = GameLogic.getCurrentScene()
objList = scene.objects
sun = objList["OBsun"]
#act_rotate = controller.actuators["rotate"]
sen_sempre = controller.sensors["sempre"]
degree = 45.0
if sen_sempre.positive:
# set angular displacement vector
#degree = degree + 45.0
matrixNew = Mathutils.RotationMatrix(degree, 3, "y")
# set owner's world orientation
sun.localOrientation = matrixNew # [[1.0, 0.0, 0.0], [ 0.0, 1.0, 0.0], [0.0, 0.0, 1.0]]
# active controller
#controller.activate(act_rotate)
Well if you want to get complicated…I guess that would work.
or…
from math import pi
#Just set the following values to your motion actuator.
90d = pi/2
-90d = -pi/2
45d = pi/4
-45d = -pi/4
#etc...