cancel
Showing results for 
Search instead for 
Did you mean: 

oculus quest controller orienting on world center [Unity3d]

Panicaim
Honored Guest
I tried to write my own camera rig in unity3d but for some reason the Quest controller are orienting on the world center instead of there parent camera object
this is all my code i wrote for it

I am using oculus integration 1.8

    public Transform leftController;
    public Transform RightController;
    public Transform camera;
    // Start is called before the first frame update
    void Start()
    {
        camera = gameObject.GetComponent<Transform>(); // i

        OVRManager.display.RecenterPose(); // made this as a meaning to fix the world center problem - didn't work
    }

    // Update is called once per frame
    void Update()
    {

        leftController.SetParent(camera); // i thought maybe the controller loses it parent on launch - didn't work
        RightController.SetParent(camera); // i thought maybe the controller loses it parent on launch - didn't work

        OVRInput.Update();
        leftController.transform.localPosition = OVRInput.GetLocalControllerPosition(OVRInput.Controller.LTouch);
        leftController.transform.localRotation = OVRInput.GetLocalControllerRotation(OVRInput.Controller.LTouch);

        RightController.transform.localPosition = OVRInput.GetLocalControllerPosition(OVRInput.Controller.RTouch);
        RightController.transform.localRotation = OVRInput.GetLocalControllerRotation(OVRInput.Controller.RTouch);
    }

0 REPLIES 0