theuns
(theuns)
February 10, 2013, 2:54am
1
Hi does anyone have an example of how this works to rotate an object?
I place the objects via addObject which works, but then I need to rotate each to a different position every time,
I have tried :
block = scene.addObject('block', place)
block.rotation_euler(90,-90,0)
gives a message that “object has no attribute rotation_euler”
and also
block = scene.addObject(‘block’, place)
block.applyRotation((90,-90,0),False)
but the rotation does not work?
agoose77
(agoose77)
February 10, 2013, 3:12am
2
Rotation_euler is the python attribute for BPY. It is a different interface to the BGE API.
applyRotation works. Therefore, either the script isn’t running, you’re trying to rotate a SoftBody or you’ve set an angle which makes it look like it isn’t rotating.
See here http://www.tutorialsforblender3d.com/GameModule/ClassKX_GameObject_5.html
mb10
(mb10)
February 10, 2013, 3:35am
3
Rules for rotating and moving objects in the game engine (angles are in radians):
'
# Incremental Rotation:
obj.applyRotation([DeltaAngleX, DeltaAngleY, DeltaAngleZ], local = false)
# Incremental movement
obj.applyMovement([DeltaX, DeltaY, DeltaZ], local = false)
# Absolute rotation:
obj.localOrientation = [AngleX, AngleY, AngleZ] # local
obj.worldOrientation = [AngleX, AngleY, AngleZ] # world
# Absolute movement
obj.localPosition = [NewX, NewY, NewZ]
obj.worldPosition = [NewX, NewY, NewZ]