Hi, I’m making a VR game with VIVE, and I want the view to be locked at a certain position, but still allowed to look around.
In other words, I want to simulate Occulus behaviour with a VIVE setup 
At first sight I thought it would be piece of cake, but I’m fairly stuck in my project, I tried a lot to modify the SteamVR scripts, to apply “(local)position = Vector3.zero every Updates”, nothing works…
I did not found this issue on unity’s forum so If you have any ideas, let me know,
thanks a lot 
4 Answers
4
I finally figured out a solution: Moving the camera rig to offset the head position, but it only works if you use localPosition, there is my script: (put it directly on [CameraRig])
public class CameraRigStabilizer : MonoBehaviour {
private Vector3 InitialPos;
private Vector3 hmdPos;
public GameObject HMD;
public Transform CameraPos;
void Start ()
{
InitialPos = transform.position;
}
// Update is called once per frame
void LateUpdate ()
{
//hmdPos = HMD.transform.position; Can't work in world position
//transform.position = InitialPos - hmdPos; for some reason
hmdPos = HMD.transform.localPosition;
transform.position = CameraPos.position - hmdPos;
}
}
HMD = camera (head)
, CameraPos = Where you want your head to be
hope that will help someone 
UnityEngine.XR.InputTracking.disablePositionalTracking = true;
Dear @Kerbiriou ,
I have a similar task, (but I have to discard Z_rotation) and your script looks like a great place to start. Anyway, I can’t reproduce your solution even without any changes. Can you share a demo scene (work37 gmail com) or explain more verbosely how to use your scipt?
I’ve attached it to [CameraRig], HMD = camera (head) ,
CameraPos = I’ve made an empty GameObject in the Root of the hierarchy. Maybe something here is wrong
Thanks!
Dear @Kerbiriou ,
I tried to use your script for allowing rotation only.
(I put this script on [CameraRig], and I attached Camera(head) object as HMD, empty gameObjcect as CamerPos)
But, camera still move around.
Do you have any idea to solve this problem?
Thanks!
I’m working on Unity 5.5.
You're welcome! :)
– ThePersister