I’m working on an AR app using vuforia and am having difficulties with rotations in their system.
At this point, I just need to figure out how to calculate an angle relative to the camera, for an object, as the camera moves around in crazy rotations/orientations…
So if you have the camera pointing at a paper on a table, at a 45 degree angle, I need the object that spawns on the paper to be another 45 degree’s from straight up and down to become perpendicular to the camera…
The problem is the input from the camera seems to behave like a gyroscope, there are multiple cameras in the scene and behavior is very different from plain Unity. I keep running into gimbal lock issues and have tried a number of things. Even childing 3 gameobjects for y,x,z to act as containers for my object, then only referencing the y gameobject for y rotation yet it isn’t even close to working as expected.
So to keep this as basic as possible, how can I constantly adjust the rotation of the object to be perpendicular to the camera as the camera moves around freely in all kinds of crazy directions…
On the simple end I tried to use transform.LookAt(camera.transform.position); which doesn’t work as you’d think(or as it normally wold)…it’s not even close to perpendicular.
I even childed a gameobject to the camera, in front of it, lined up the xyz to be exactly how I want the object, and when I move the object to that gameobject’s position/rotation, it’s not perpendicular to the camera!!! ugh