Make camera tracking the view in VR
hi, first i want to apologize for my bad english(i'm french).
I tried all the day to make my camera going wherever i want but i didn't succeed, seriously i'm fed up. I easily succeed making the camera tracking the head orientation with the scripts and prefabs but there is not (unless i'm wrong) things for making the camera going where the cardboard is looking....
Answer by chelder · Nov 04, 2015 at 05:50 PM
UPDATE 3
I have solved this question here: http://answers.unity3d.com/questions/1093965/google-cardboard-rigidbodyfirstpersoncontroller-sc.html#answer-1094375
Old answer:
I think I'm doing that too right now. There is a tutorial of that (called autowalk by the author) here: http://danielborowski.com/posts/create-a-virtual-reality-game-for-google-cardboard/
Anyway, I read in some other place that it is better to use the new script of the Standard Assets: Characters > FirstPersonController > Scripts > RigidbodyFirstPersonController.cs
I have copied the code of that script in another script I called RunAutoWalk.cs. I have attached it to Main Camera.
I have modify the FixedUpdate()
function of RunAutoWalk.cs, adding the following line of code right above the line Vector2 input = GetInput();
input.y = 1f;
That is like keeping the up key pushed, so the camera is moving through the direction we are seeing.
UPDATE
I have asked to the community if there is a more elegant way to do it here: http://answers.unity3d.com/questions/1093452/best-practices-hierarchy-does-not-seem-possible-be.html
UPDATE 2
It is working in the computer with the keyboard and mouse, but not in the phone it falls through the floor. I have asked about that problem here: http://answers.unity3d.com/questions/1093965/google-cardboard-rigidbodyfirstpersoncontroller-sc.html