Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prevent head tilt and scene jitter #41

Open
Ketucalibur opened this issue Apr 23, 2016 · 1 comment
Open

Prevent head tilt and scene jitter #41

Ketucalibur opened this issue Apr 23, 2016 · 1 comment

Comments

@Ketucalibur
Copy link

Ketucalibur commented Apr 23, 2016

Hello,
thanks for your great codes.

I uncomment the following codes to prevent head tilt:
GLKQuaternion q = GLKQuaternionFromTwoVectors(touchVector, nowVector);
//_offsetMatrix = GLKMatrix4Multiply(_offsetMatrix, GLKMatrix4MakeWithQuaternion(q));
// in progress for preventHeadTilt
GLKMatrix4 mat = GLKMatrix4Multiply(_offsetMatrix, GLKMatrix4MakeWithQuaternion(q));
_offsetMatrix = GLKMatrix4MakeLookAt(0, 0, 0, -mat.m02, -mat.m12, -mat.m22, 0, 1, 0);

when I pan around the scene directly up or down(i.e. abs(mat.m02) is close to 1), the scene will shake. I try to solve this problem by changing the codes as following:
if (fabs(mat.m02) < 0.8) {
_offsetMatrix = GLKMatrix4MakeLookAt(0, 0, 0, -mat.m02, -mat.m12, -mat.m22, 0, 1, 0);
}

but I think this solution is ugly, and I want to know how to avoid scene jitter more effectively?

Thanks a lot

@chrismerron
Copy link

chrismerron commented Apr 28, 2016

I removed the jitter by removing the first _offsetMatrix assignment:
GLKVector3 nowVector = [self vectorFromScreenLocation:[sender locationInView:sender.view] inAttitude:_offsetMatrix]; GLKQuaternion q = GLKQuaternionFromTwoVectors(touchVector, nowVector); // in progress for preventHeadTilt GLKMatrix4 mat = GLKMatrix4Multiply(_offsetMatrix, GLKMatrix4MakeWithQuaternion(q)); _offsetMatrix = GLKMatrix4MakeLookAt(0, 0, 0, -mat.m02, -mat.m12, -mat.m22, 0, 1, 0);

However, when you pan to the bottom of the image it goes a little crazy. Do you have any idea Robby? Awesome piece of work by the way, great implementation of the panoramic view :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants