Search code examples
unity-game-enginevirtual-reality

SmoothFollow camera in VR


In a test scene with a locomotion character, when I attach a SmoothFollow script to the character, it works as it should, but when I use Oculus Rift to view the scene in VR, it no longer follows the character as it walks...

I am aware that the camera transform is over-ridden with the head-tracked pose, and that if I want to move the camera, I must attach it as a child to another game object and then move the root game object, but doing so still would not let me follow the character in VR.

Am I missing something, or is it not possible to have this in Oculus Rift where you can just make the character walk and you automatically follow it?


Solution

  • It sounds like you are close. Did you attach the SmoothFollow script to the new GameObject (parent of the camera) rather than the camera itself?

    Also, you may want to comment out the part of SmoothFollow where it sets the rotation of the camera - this can be very disorienting in VR.