simple rotation in 2.5

after selecting an object in 2.5

how do you rotate it in degrees?

i mean do you need to set the mode like quaternion or euler ect… before

or is there a simple command to rotate it angle around one of the global axis ?

i mean from the bpy ,struct not the ops one !

but not really this one
i can see in report console the command like

bpy.ops.transform.rotate(value=(-0.810085,), axis=(0, 0, 1), constraint_axis=(False, False, True), constraint_orientation=‘GLOBAL’, mirror=False, proportional=‘DISABLED’, proportional_editing_falloff=‘SMOOTH’, proportional_size=1, snap=False, snap_target=‘CLOSEST’, snap_point=(0, 0, 0), snap_align=False, snap_normal=(0, 0, 0), release_confirm=False)

but first of all is there a shorter eay to write this command like options for most of the parameters?

this is way too long to write in a script !


Use an always sensor connected to a python script controller. First have the euler angle you want to turn in radians and put it in:

applyRotation([X,Y,Z], True/False)

being X, Y, and Z the axis around which you want to turn that euler angle. It works for me, good luck

can you show example whre you select let say the default cube and then do this rotate thing ?


Hi again,

It seems it’s not possible to attach a blend file in these forums anymore, so I’m pasting the python code here. You just have to add a python controller with the script name pointing to the code that I’m sending here.

# File name:
# Use the spacebar to rotate the robot.
# You can see the angle in the top left corner.

import math
import Mathutils

controller = GameLogic.getCurrentController()
scene = GameLogic.getCurrentScene()

bot = scene.objects["Cube"]

bot.applyRotation([0,0,0.01], False)
matBot = bot.worldOrientation
angBot = matBot.to_euler()[2]
bot["Angle"] = angBot

Add a sensor to the cube, which could be a “space bar” keyboard, so every time you press it the python script will be called and execute the rotation in the Z axis. If you want to see the current angle, add a property of type float called “Angle” to the cube and don’t forget to click on the “Print debug information” symbol so you can see it in real time. If you don’t want to see the angle then just erase the last 3 lines of the code.