Device Motion gimbal lock problem

So it has been a frustrating problem for quite a while which really holds me back on continuing some of my unpublished filter. I’ve tried to solve it myself but still doesn’t really fixes things, can someone help me to translate Device Motion rotation to a 2D translation with no gimbal lock issue? It’s so annoying.

I’ve tried to adopt quaternion from this video, but still doesn’t work:

Is this issue inherited by the spark ar itself? device limitation? or most likely my faulty math?

It seems crazy that this is still an issue today. I feel like it’s part of the core of what powers the AR, and it’s clearly working for all of the built-in behavior like world space particles, plane trackers, and anything else that exists in world space.

I never came up with a good solution for it, but Spark does have native support for quaternions now. I wonder if you could use some world space object as a point of reference to construct a quaternion, then convert that back into euler angles.

by reference point do you mean using the lookat function?

You just need two vectors to compare to get the angle, so you can put a null object in the focal distance and compare it to the camera position.

I think you can dig in the threejs code to find a solution Get Euler between two Vector3's - Questions - three.js forum

1 Like