Is there not a localRotation function? I see a localScale function, and it work so nice and easy. I tried LocalOrientation, but I see it as “why the crap would you do it that way?!”. I can’t get it to work anyway.
Thanks
Is there not a localRotation function? I see a localScale function, and it work so nice and easy. I tried LocalOrientation, but I see it as “why the crap would you do it that way?!”. I can’t get it to work anyway.
Thanks
You mean represent it as a matrix? (I think that’s how orientation is represented).
You can convert a matrix into euler values (ie x,y,z) using matrix.to_euler()
Alright, noob in progress: How would I use that? :o
You would do something like this:
from bge import logic
import mathutils
own = logic.getCurrentController().owner
localRotation = own.localOrientation.to_euler()
# add rotation to localRotation
own.localOrientation = localRotation.to_matrix()
Rules for rotating and moving objects in the game engine (all 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] # local
obj.worldPosition = [NewX, NewY, NewZ] # world
Thanks guys! Helped a bunch