flipping gravity based on angle of iphone?

Tremblay2568Tremblay2568 Member Posts: 1
edited November -1 in Working with GS (Mac)
Hi all,

I would like to make a game that flips the world gravity based on which side of the iphone is facing down. is this possible? if so how do i determine which side of the iphone is facing down?

Thanks for your help!

Comments

  • old_kipperold_kipper Member Posts: 1,420
    Use device orientation through the attribute browser for the the simple version but this doesn't work if the device is locked by the user to display in one orientation, but you can get around this by monitoring the rotation like this (vectorToangle(accel.x,accel.y)+180)/45. This divides the rotation into 8 and you can select the 2 numbers that you want to use as switches for each side. I do it this way as 0 degrees is flat left landscape (the ay I have got it set up to avoid going negative), and you want to be able to switch not on the centre point but at the corners.
Sign In or Register to comment.