I set the build.config orientation setting to landscape for my game and gravity starts out fine, but I am messing it up with the onTilt event. I had it working when starting in portrait mode with the standard:
physics.setGravity(10*event.xGravity,-10*event.yGravity)
but I can’t figure out to change this for starting in landscape (landscapeRight to be precise).
[import]uid: 11767 topic_id: 4198 reply_id: 304198[/import]
X and y tilt do not change with orientation change [import]uid: 7911 topic_id: 4198 reply_id: 13033[/import]
I got the fix, just needed a break. It was the -10 on the x parameter I was missing.
physics.setGravity(
-10 * event.yGravity,
-10 * event.xGravity) [import]uid: 11767 topic_id: 4198 reply_id: 13035[/import]
careful on flipping orientation, I have a minus as well on mine (but only using Y axis) and when I switch mode from landscape right to left, the tilt behaves backwards; meaning, tilting left, now is right and vice a versa…unless I’m doing something wrong =S [import]uid: 7856 topic_id: 4198 reply_id: 13043[/import]
That is what I was missing. I had to exchange x and y and add the “-” to the x parameter for right and take it off for left landscapes. [import]uid: 11767 topic_id: 4198 reply_id: 13049[/import]