We have a game that plays only in landscape rotation (LandscapeLeft and LandscapeRight).The screen rotates instantaneously instead of a smooth rotation like other application. The screen "teleports" from LandscapeLeft to LandscapeRight.
How can we rotate the screen smoothly like other iOS app?
I don't know if this will help but I figured since I couldn't see an easy way to do this...
link text
On the other hand you could always fake it
I faked the rotation already at rotating the camera. The link you provided is very helpful. I was not sure if the speed was constant and how long it was rotating (1 revolution per second).
To tell you the truth I just googled it and found that link, on the other hand I don't see a way of calling iphone functions except those you showed above. My idea is that you can rotate to the half then flip the orientation and then flip the camera...then continue rotating the camera
I'm using the following script to smoothly rotate the camera, and thus rotate the screen.
I have four GameObjects in my scene with the rotation values set as needed. Then I assign this script to the MainCamera and the four GameObjects to the script.
static var offset : Vector3; //Offset from target
var facing1 : GameObject;
var facing2 : GameObject;
var facing3 : GameObject;
var facing4 : GameObject;
private var smoothFollowScript : SmoothFollow;
function Start ()
{
this.smoothFollowScript = GetComponent(SmoothFollow);
}
function Update ()
{
if (GameController.deviceOrientation == 1) {
setRotation(1);
} else if (GameController.deviceOrientation == 2) {
setRotation(2);
} else if (GameController.deviceOrientation == 3) {
setRotation(3);
} else if (GameController.deviceOrientation == 4) {
setRotation(4);
}
}
function setRotation (direction : int) {
var startTime = Time.time;
var startRot = Camera.main.transform.rotation;
if (direction == 1)
targetRot = facing1.transform.rotation;
else if (direction == 2)
targetRot = facing2.transform.rotation;
else if (direction == 3)
targetRot = facing3.transform.rotation;
else if (direction == 4)
targetRot = facing4.transform.rotation;
Camera.main.transform.rotation = Quaternion.Slerp(startRot, targetRot, Time.deltaTime * 0.7);
yield;
}
I faked the rotation already at rotating the camera. The link you provided is very helpful. I was not sure if the speed was constant and how long it was rotating (1 revolution per second).
– anon86743871To tell you the truth I just googled it and found that link, on the other hand I don't see a way of calling iphone functions except those you showed above. My idea is that you can rotate to the half then flip the orientation and then flip the camera...then continue rotating the camera
– anon18767588