Forum Discussion

🚨 This forum is archived and read-only. To submit a forum post, please visit our new Developer Forum. 🚨
seanarvr's avatar
seanarvr
Honored Guest
8 years ago

How to change centerEyeAnchor position and rotation

I have been trying to change centerEyeAnchor position and rotation. So I can use my own positional tracking data. 
Below are the codes I have:


void OnUpdatedAnchors(OVRCameraRig rig)
    {
        if (!enabled)
            return;

        //these two lines are used to obtain positional data from my tracking system
        centerEyePose.position = GetPos();
        centerEyePose.orientation = GetRotation();

        //This doesn't work because VR camera poses are read-only.
        rig.centerEyeAnchor.FromOVRPose(centerEyePose, true);
        rig.leftEyeAnchor.FromOVRPose(centerEyePose, true);
        rig.rightEyeAnchor.FromOVRPose(centerEyePose, true);
}



I registered above codes to OVRCameraRig.UpdatedAnchors event
I was able to control  leftEyeAnchor & rightEyeAnchor, but centerEyeAnchor has no effect. 
Does anyone know how to modify centerEyeAnchor ? 
Please help 



2 Replies

Replies have been turned off for this discussion
  • seanarvr's avatar
    seanarvr
    Honored Guest


    Hi,

    This was previously answered in this forum post here. Is this a Gear VR or PC project?

    This is a PC project. 
    I read the post you attached.
    I have wrote and tested the following script, and attached to CenterEyeAnchor object, but it didn't work. the position still shown (0,0,0). What might be some possible mistakes I made ? FYI, I am using my own tracking devices. 

        protected virtual void LateUpdate()
        {
            if (rigidId < 0)
                return;
    //GetPos()function: get position data from my own motion capture tracking devices (opti-track)
            transform.localPosition = GetPos();

        }