Rotate gravity

alexander144alexander144 Member Posts: 93
edited November -1 in Working with GS (Mac)
Basically what the title says. What I want to do exactly is when the player tilts there iphone the gravity will tilt. Thanks.

Comments

  • StormyStudioStormyStudio United KingdomMember Posts: 3,989
    hmm.. try using the accelerate behavior instead of gravity...

    That way you can control direction and do some rules that work out the amount of acceleration depending on the increase or decrease in the device accelerometers X and Y..

    I imagine there is a Labyrinth type template/demo/tutorial somewhere. Where as you tilt the device the ball would roll in that direction...
  • old_kipperold_kipper Member Posts: 1,420
    Tshirtbooth's accelerometer tutorial is the place to start. It is quite a complex thing to get right if you want to take it a lot further (at least for my feeble brain), especially if you want the actors to interact with the surfaces of other objects and orientate to them from more than set angles. I have a actor climbing about, tumbling, falling and reacting to the changing 'gravity', but though the 'gravity' is produced in full rotation by the accelerometer x/y, I limit my displayed animation to 4 directions. This works most of the time and I'm trying to make it more elegant. The problem with my actors is that they drawings of complex shapes and the boundary boxes for collision detection become obvious if rotated. I can kludge up in 4 directions with discrete animation & triggered behaviours to get around somethings, but this has a memory cost (and time and drawing). Pushing it further is what I am working at...

    Currently I am using the device orientation to flip the actor animation even though the scene is fixed but this has a delay and I am working on using a faster method. Suggestions? I know that I could create rules for my own rotation feedback but I am sure that IOS has switching in it at a level I can't get at earlier, but we shall see. I am a newbie (about a week) to this and not familiar with how others are doing it.

    There is also the matter of the Apple requirement of the app being able to orientate in at least 2 orientations and I am not sure if if this approach actually qualifies even though it is an 'all direction' interface. If someone could tell me if it is then please let me know. I presume that it is otherwise Labyrinth type games would not be saleable.

    Cheers and thanks to everyone here for the giving out.
Sign In or Register to comment.