- Home /
Is there a way to know the screen orientation when Screen.orientation == ScreenOrientation.AutoRotation?
There's not, right? The best we have is Input.deviceOrientation?
Answer by Jessy · Jul 10, 2012 at 11:30 AM
No. But UT is working on a solution for why this matters to me (it's possible for the screen to not actually match device orientation, when using Autorotation).
Answer by mohanrao164 · Jun 29, 2012 at 05:09 AM
hi
Hope this would be helpful
actually i didn't used input.device orientation instead i used vector3.dot operation.
public void AutoOrientToLandScape()
{
if(Vector3.Dot(Input.acceleration.normalized,new Vector3(1,0,0)) > 0.45)
{
Screen.orientation=ScreenOrientation.LandscapeRight;
}
else if(Vector3.Dot(Input.acceleration.normalized,new Vector3(-1,0,0)) > 0.45)
{
Screen.orientation=ScreenOrientation.LandscapeLeft;
}
}
No, I want to know the orientation of the auto-rotated screen. Reading acceleration should result in the same result as deviceOrientation at app launch, which is when I need this.
Out of interest, does Screen.orientation
not yield the value your after? http://docs.unity3d.com/Documentation/ScriptReference/Screen-orientation.html?from=ScreenOrientation
@kruncher check out the ScreenOrientation enumeration and then my question again.
@Jessy Ahh gotchya! I can see what your saying now
Your answer
Follow this Question
Related Questions
Splash screen orientation - iOS 2 Answers
Calibrating Accelerometer Values 1 Answer
How to set my 3d object orientation with mobile ? 1 Answer
point the north 1 Answer