- Home /
Panorama reset position/angle.
Hello all,
I'm doing with panorama scene for ipad. I used default script MouseOrbit for my camera to interactive panorama. But my problem is, when i touch in ipad's screen, camera alway reset position/angle (0,0,0 - example). It is not continue from existing position/angle.
Could you let me know scrip do fix it? Thanks.
THANKS.
Please post your current script, and what you have done to adapt it for touch.
Very basic. $$anonymous$$y scene have a camera, a skybox with panorama material. I added $$anonymous$$ouseOrbit script (in Standard Assect) to my $$anonymous$$ain Camera. After build and run in iPad, any screen touch - my camera alway reset position/angle. :(
@quenhoai2003 few things to note:
Do not post comments as answer.
@tanoshimi has asked for the current script you are using, without which it is not possible for us to tell why the position/angle is resetting.
@Harshad$$anonymous$$ Thanks for your re$$anonymous$$d. I will note it. I'm not sure about your commend but now i post my screenshot and script i used.
var target : Transform;
var distance = 10.0;
var xSpeed = 250.0;
var ySpeed = 120.0;
var y$$anonymous$$inLimit = -20;
var y$$anonymous$$axLimit = 80;
private var x = 0.0;
private var y = 0.0;
@script AddComponent$$anonymous$$enu("Camera-Control/$$anonymous$$ouse Orbit")
function Start () {
var angles = transform.eulerAngles;
x = angles.y;
y = angles.x;
// $$anonymous$$ake the rigid body not change rotation
if (GetComponent.<Rigidbody>())
GetComponent.<Rigidbody>().freezeRotation = true;
}
function LateUpdate () {
if (target) {
x += Input.GetAxis("$$anonymous$$ouse X") * xSpeed * 0.02;
y -= Input.GetAxis("$$anonymous$$ouse Y") * ySpeed * 0.02;
y = ClampAngle(y, y$$anonymous$$inLimit, y$$anonymous$$axLimit);
var rotation = Quaternion.Euler(y, x, 0);
var position = rotation * Vector3(0.0, 0.0, -distance) + target.position;
transform.rotation = rotation;
transform.position = position;
}
}
static function ClampAngle (angle : float, $$anonymous$$ : float, max : float) {
if (angle < -360)
angle += 360;
if (angle > 360)
angle -= 360;
return $$anonymous$$athf.Clamp (angle, $$anonymous$$, max);
}
Hope it is correct @tanoshimi commend.
Thanks all.
try to Debug.Log your Input.GetAxis() values in LateUpdate. And x and Y too. How they behave at touch moment?
Your answer
Follow this Question
Related Questions
Interactive 360 panoramas camera script 1 Answer
Best solution for interactive panorama? 2 Answers
Lines on 360 image? 1 Answer
On looking to far up or down Random Rotation bug 1 Answer
Mapping hi-resolution image to an object 2 Answers