rotation command?

Scripting in Blender with Python, and working on the API

Moderators: jesterKing, stiv

Jedijds
Posts: 126
Joined: Mon Jan 30, 2012 5:19 am

rotation command?

Postby Jedijds » Wed Sep 04, 2013 12:41 am

What command do I use to find the angle of rotation and set the rotation of and object?
۞◄█°‖‖‖‖‖█ʭʭ╬(░▒▓▓▒▒▒▒▒▒▒▒▒)

CoDEmanX
Posts: 894
Joined: Sun Apr 05, 2009 7:42 pm
Location: Germany

Postby CoDEmanX » Wed Sep 04, 2013 2:34 pm

Depends... do you mean the object rotation or the orientation of a mesh's data?

Object rotation can be read, from matrix_world.to_3x3() or the appropriate rotation_* attribute (depends on mode)

You can assign to these attributes, or use the transform.rotate operator. Angle.is.given in radians.
I'm sitting, waiting, wishing, building Blender in superstition...

Jedijds
Posts: 126
Joined: Mon Jan 30, 2012 5:19 am

Postby Jedijds » Wed Sep 04, 2013 3:19 pm

this command finds its position, bge.logic.getCurrentScene().objects['Cube'].worldPosition[0] , but what about a command that finds its rotation? does that help any?
۞◄█°‖‖‖‖‖█ʭʭ╬(░▒▓▓▒▒▒▒▒▒▒▒▒)

CoDEmanX
Posts: 894
Joined: Sun Apr 05, 2009 7:42 pm
Location: Germany

Postby CoDEmanX » Wed Sep 04, 2013 8:45 pm

oh is it about the game engine?
I'm sitting, waiting, wishing, building Blender in superstition...

Jedijds
Posts: 126
Joined: Mon Jan 30, 2012 5:19 am

Postby Jedijds » Wed Sep 04, 2013 11:49 pm

yes, I should have mentioned that first, is there some other place I need to ask for the bge?
۞◄█°‖‖‖‖‖█ʭʭ╬(░▒▓▓▒▒▒▒▒▒▒▒▒)

CoDEmanX
Posts: 894
Joined: Sun Apr 05, 2009 7:42 pm
Location: Germany

Postby CoDEmanX » Thu Sep 05, 2013 3:01 pm

well, either post BGE script questions here with a note that it's about BGE or use the Interactive 3D section: http://www.blender.org/forum/viewforum.php?f=13

see this page for rotation in bge:

http://www.blender.org/documentation/bl ... rientation
I'm sitting, waiting, wishing, building Blender in superstition...

Jedijds
Posts: 126
Joined: Mon Jan 30, 2012 5:19 am

Postby Jedijds » Thu Sep 05, 2013 4:55 pm

yes I looked there, is the local orientation the command im looking for? if I put 1 for x and then run the command worldPosition[0] I get 1 now what about rotation if I put 1 degree for x axis how do I find that through text editor? if the object gets applied rotation I want to know what angle its now facing.
۞◄█°‖‖‖‖‖█ʭʭ╬(░▒▓▓▒▒▒▒▒▒▒▒▒)

CoDEmanX
Posts: 894
Joined: Sun Apr 05, 2009 7:42 pm
Location: Germany

Postby CoDEmanX » Fri Sep 06, 2013 10:42 pm

the BGE module is only available while game engine is running, you can't test BGE-specific code "outside"

localOrientation or worldOrientation are the relevant ones, yes. They return a 3x3 rotation matrix. Not sure about the axis in bge, but -Y of the matrix might be the forward vector.
I'm sitting, waiting, wishing, building Blender in superstition...


Return to “Python”

Who is online

Users browsing this forum: No registered users and 0 guests