Topic locked

Rotation, parent as camera, and forward vector with an AR camera

Unity Editor
May 13, 2022 - 7:35am #1

Hello to all,
I'm developing an phone app with the Vuforia package for AR in Unity.
I want to make a game objet follow a calculated rotation from touch input in addition to the camera rotation, so that it acts like a cursor to interact with the scene objects, following the camera.

I tried two setups using the midair placement components with the world origin set to the midair stage :

- One where the camera is the object's parent and using the object's forward vector to vary the rotation while still following the camera's rotation and position. This version actually works for the position of the object bit stays in the center of the camera with no offset forward rotation from input using build phone.

- The other with the position and rotation of the camera given to object, setting the forward vector afterwards in the update script, this version follows neither the camera nor the input using build on phone.

BOTH of these setups work perfectly when simulating on phones in Unity editor, I can move the camera's position in runtime or set the rotation of the camera before playing the simulation and the offset forward follows the camera AND the user input.

So I'm guessing that the camera's rotation and position are dealt with otherwise with Vuforia in runtime than in the editor's simulator. Maybe the child objects have to have the exact same rotation as the camera, either that or scripts are disabled on camera's children ?

Can't seem to resolve this... Anyone had the time to read me ? Basically, I need to access the camera's transform in runtime and add an extra rotation from input to a following object. Thanks in advance for any enlightenment.

Platform: 
Topic locked