The question is explained in the following picture. Now I have Quaternions data of Q1, Q2, and Q3. How could I calculate Q4? Thanks in advance for helping.
To make it more clear:
I want to develop a 3D Indoor navigation app which allows the user to upload the route and reproduce the route at the same location.
When creating a path and upload: At first, the user opens the camera and got the initiate location is O, then he will store the translation and rotation data of X, which is a predefined location. Finally creating their path by record another point like Y relative to O.
When reproducing the path user created before, they open the camera again and get another initiate location O'. He can go the predefined location again and get translation and rotation of X again. Then I could calculate the Y relative to O' and reproduce the point.
In my point of view, I could calculate translation by the vector calculation: O'X - OX + OY = O'Y
But I'm not familiar with quaternions and rotation part. I've tried the same method but turns out not correctly. So I simplize the question as the model described in the graph and ask for some help.
I think Quaternion.SetLookRotation
suit your problem, it converts a forward vector (and a up vector) to quaternion, and the up vector for people is usually Vector3.up
, so:
var Q4 = Quaternion.SetLookRotation(/* vector Y-O' here */);