Author Topic: getting and re-applying object rotation  (Read 990 times)

Offline dutch_delight

  • int
  • **
  • Posts: 58
    • View Profile
getting and re-applying object rotation
« on: April 04, 2012, 11:26:44 pm »
Hi all,

I'm struggling with saving my game state. basically when the player quits my game, I want to save the health, position and rotation of the player.
Everything works fine apart from the rotation part.

To rotate my player in the world, I use either a joystick or screen tilt input and apply it like this:
Code: [Select]
I thought that I could just take the value like this:
Code: [Select]
save_rotation_data_Y = player.getRotationMatrix().getYAxis().x
then when the game restarts, all objects are re-initialized (player rotation is back to default)
and then I reload the rotation data and apply it like this:
Code: [Select]
But the rotation is not what it should be. The data saves and loads correctly (fuel, missiles, translation all are fine) but I dont think I'm looking in the right place for the rotation.
I've tried every axis and even tried saving out the rotation matrix but I know even less about that so I must be doing it wrong.

Any help would be very much appreciated.

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11970
    • View Profile
Re: getting and re-applying object rotation
« Reply #1 on: April 04, 2012, 11:46:05 pm »
Just save and restore the rotation matrix instead.