Hy guys.
I want to do an easy task with gear VR but i got a big problem.
I just want to switch the position of the camera when the user tap or double tap in the touchpad of the gear VR.
I followed this tuto to make my app in VR : VR Best Practice - Unity Learn
When i launch my scene in unity all works perfectly but when i lauch the app on my phone and with the gear VR nothings works :'(.
My scene is composed by a character and a camera.
In the character i got 2 transform for the 2 position of my camera.
First of all i initialize my camera at one position (and i just want to switch to the other position).
Here the script i use :
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
private enum PosCam
{
tps,
fps,
};
public class InputManager : MonoBehaviour {
private VRInput input;
[SerializeField]private GameObject GO_cam;
[SerializeField]private Transform Pos_Fps;
[SerializeField]private Transform Pos_Tps;
private PosCam camState;
void Start()
{
Debug.Log("Start InputManager");
input = this.GetComponent<VRInput>();
if (input==null)
{
Debug.Log("error VRInput");
}
else
{
Debug.Log("Sucess launch VRInput");
}
GO_cam.transform.position = Pos_Tps.position;
Debug.Log(Pos_Tps.position);
camState = PosCam.tps;
input.OnDown += switchcam;
}
void switchcam()
{
Debug.Log("In SwitchCam");
if (camState == PosCam.fps)
{
Debug.Log("aaaaaaa");
GO_cam.transform.position = Pos_Tps.position;
camState = PosCam.tps;
}
else if (camState == PosCam.tps)
{
Debug.Log("ffffffff");
GO_cam.transform.position = Pos_Fps.position;
camState = PosCam.fps;
}
}
}
As i said all works in unity but when i use my phone and the gear VR, first my camera is’nt at the place where i initialize it and when i use the touchpad nothing append.
Please help !!