Rotating orientation doesn't rotate game

Hello everyone,

I am developing a landscape game and at some point it has now stopped rotating the view when I turn my iphone the other way. The corners of the screen rotate like it should, however the game itself stays in its original orientation. Here is my build.settings file:

settings =  
{  
 orientation =   
 {  
 default = "landscapeRight",  
 content = "landscapeRight",  
 supported =   
 {  
 "landscapeLeft", "landscapeRight",  
 },  
 },  
 androidPermissions =  
 {  
 "android.permission.INTERNET"  
 },  
 iphone =  
 {  
 plist =  
 {  
 UIApplicationExitsOnSuspend = false,  
 UIPrerenderedIcon=true,  
 UIStatusBarHidden=true,  
 CFBundleIconFile = "Icon.png",  
 CFBundleIconFiles = {  
 "Icon.png" ,   
 "Icon@2x.png" ,   
 "Icon-72.png" ,   
 "Icon-Small-50.png" ,   
 "Icon-Small.png" ,   
 "Icon-Small@2x.png"  
 },  
 CFBundleDisplayName = "Game Name",  
 },  
 },  
}  

Does anyone have any idea why it is animating the rotation but not actually rotating the game? [import]uid: 31262 topic_id: 12754 reply_id: 312754[/import]

not mentioned on which platform if it is for android it only supports landscaperight orientation [import]uid: 12482 topic_id: 12754 reply_id: 46763[/import]

It’s on iPhone [import]uid: 31262 topic_id: 12754 reply_id: 46764[/import]

ok try to get rotationFix.lua from code exchange i think it will solve your problem [import]uid: 12482 topic_id: 12754 reply_id: 46765[/import]

Hgvyas123 thanks for being helpful as usual. I’ll give it a try tonight when the kids are in bed :slight_smile: Here is the code in question in case someone is searching for it in the future:

http://developer.anscamobile.com/code/proper-orientation-rotation-animation [import]uid: 31262 topic_id: 12754 reply_id: 46801[/import]

Just to update, the fixrotation.lua did not work because all of my physics dragging objects started moving in the opposite direction that I was dragging them. I removed the following line from my build.settings and the regular method started working again:

content = “landscapeRight”, [import]uid: 31262 topic_id: 12754 reply_id: 46910[/import]

Just replied your Q on code exchange page regarding reversed drag.

About the “content = “landscapeRight”,” setting.

What it does is locking Corona’s OpenGL canvas. When you have removed it you have simply enabled native rotation. But if/when you are using rotationFix.lua you should put it back, because without it the result will be double reversed canvas.

So, to properly handle orientation rotations you have two options as follows.

  1. Native Way
  • In build.settings, you should not set “content”.
  • But “default” & “supported” settings should be set as always.
  • When the orientation is changed you should still check and reverse the drag, accelerometer, etc. Corona will not handle those for you.
  • OpenGL canvas will be rotated instantly, iOS native canvas will follow it with the rotation animation resulting the rotating black frame problem.
  1. My Way :wink:
  • In build.settings, you should SET “content” to match default.
  • “default” & “supported” settings should also be set as always.
  • When the orientation is changed rotationFix.lua will check for orientation and set isRotated global variable. You can use it to reverse the drag, accelerometer, etc. see my reply at code exchange page.
  • OpenGL canvas will be rotated with animation, matching the iOS native canvas as close as possible till there is a native fix for that from ansca.

I hope that helps… [import]uid: 10478 topic_id: 12754 reply_id: 46925[/import]

Thanks PixelEnvision. I think I may have to implement this in my next game as I’m too far in to go back and fix this but I must say that your fix does look very nice. [import]uid: 31262 topic_id: 12754 reply_id: 46927[/import]