Setting the rotation of an object in BGE

Hey. I am writing the controlls for a game character.(a cube for now) And I have a problem. When the cube falls on the side, I want to be able too hit ‘R’ and then the cube shall be rotated back too 0 degrees. How can I do this.

Thanks for any help :smiley:

You can probably just clear the X and Y rotations and leave the Z rotation alone to make most BGE game characters reset to a standing position.



def main(controller):

  owner = controller.owner
  owner.localOrientation[0] = 0
  owner.localOrientation[1] = 0


thanks, shall try that.