I am trying to modify the Google Cardboard SDK demo in Unity3d (version 4.6.4f1) for an Android device.
The following description is based on this -picture- I made of what I am trying to accomplish.
Thanks!
You need to use the CardboardHead part of the CardboardMain
prefab. In your cube script, leave a public GameObject reference and set it to CardboardHead
in the editor.
Next, in your double tap handling function, set your position accordingly to the forward vector of the head.
If you want the cube (or any other 3D object) to face the player, you need to use transform.LookAt()
It will probably look something like this:
public GameObject cardboardHead;
public float distanceFromCamera;
public void doubleTapped()
{
Vector3 newPosition = cardboardHead.transform.position + (cardboardHead.transform.forward * distanceFromCamera);
transform.position = newPosition;
transform.LookAt(cardboardHead.transform);
}