How to keep object “fixed” in front of camera (Google Cardboard + Unity)

I am new to Unity (and VR) and am trying to set up a small example in Google Cardboard where I have a model that turns when the user turns her head - similar to the mask demo in the Google Cardboard App. So when the user looks up, the model rotates up, when looking left, the model rotates left etc.

My scene currently has a CardboardMain and my 3D model. I have attached the Cardboard Head script to my model, which now rotates correctly with the head movement. What is missing is having the object remain in front of the camera.

In order to achieve that functionality, I created a script, which I attached to my 3D Model. The script looks like this:

using UnityEngine;
using System.Collections;

public class lookAtMe : MonoBehaviour {
    privateCardboardHead head;

    private Vector3 offset;
    public GameObject scrimshaw;

   void Start()  {
         head = Camera.main.GetComponent<StereoController>().Head;
         scrimshaw = GameObject.FindGameObjectWithTag("Scrimshaw");
   }

   void LateUpdate() {

          // head.transform.position = the position of the head on the plane
          // head.Gaze.direction = position of where the head is looking
          offset = head.Gaze.direction + head.transform.position;

          scrimshaw.transform.position = scrimshaw.transform.position + offset;
      }
 }

However, the position of my model does not change. I was under the impression that if I provide transform.position with a new vector 3 it will move the object accordingly. How else could it be done?

I did try applying transform.LookAt (target) at the Main Camera instance, setting the target to the model. While this method does work, it is way to jerky to be usable.

I appreciate any suggestions.

I made multiple Cardboard / Durovis Dive apps.

To have an object fixed to your “glasses” it might be enough to have this object as a sub object of your “glasses” in the Unity scene. So you just drag and drop it there and it will move together with your glasses. Usually no script is needed for this.

Of course it would make sense to have it at least half a meter from you so that it is comfortable to look at and the direction should be correct.

Thank you for your suggestion. I’ll try that out.

I also realized that it works as desired when disabling the Position and Rotation tracking in the Head child of CardBoardMain. This was sufficient to keep the object in focus. Since the model has the Cardboard Head script attached, all the tracking gets applied only to the model.