cancel
Showing results for 
Search instead for 
Did you mean: 

Meta Avatars Controller tracking with OVRCameraRig not working with oculus controllers.

juanphm
Level 4

I'm trying to update my project to use the new meta avatars 9.0, but we need to keep the OVRCameraRig. 

When the avatar appears the head tracking works, but the wrists only move if you use hand tracking and not controller tracking. 

I'm using the AvatarSdkManagerHorizon prefab. 

 

 

juanphm_0-1640105566003.png

 

juanphm_1-1640105665651.png

 

 

1 ACCEPTED SOLUTION

Accepted Solutions

Greetings, I have fixed the problem. 

 

To fix the problem go through the next steps: 
1. Go to SampleInputTrackingDelegate.cs line 26 (this is just a percussion) the if statement should be 

if (_ovrCameraRig != null)

2. Same script lines 36,37 changed them to (we will create the variables in the other script)

leftController = _ovrCameraRig.CustomLeftControllerAnchor,
rightController = _ovrCameraRig.CustomRightControllerAnchor

3. Either you create an inherited class from OVRCameraRig or you updated it, inside declare the variables 

public Transform CustomLeftControllerAnchor;
public Transform CustomRightControllerAnchor;

4. Add the references of the OVR Camera Rig in the scene, with the transform of your controllers. or whatever tracking you would like to do. 

View solution in original post

10 REPLIES 10

Having the same problem, help would be appreciated!

Greetings, I have fixed the problem. 

 

To fix the problem go through the next steps: 
1. Go to SampleInputTrackingDelegate.cs line 26 (this is just a percussion) the if statement should be 

if (_ovrCameraRig != null)

2. Same script lines 36,37 changed them to (we will create the variables in the other script)

leftController = _ovrCameraRig.CustomLeftControllerAnchor,
rightController = _ovrCameraRig.CustomRightControllerAnchor

3. Either you create an inherited class from OVRCameraRig or you updated it, inside declare the variables 

public Transform CustomLeftControllerAnchor;
public Transform CustomRightControllerAnchor;

4. Add the references of the OVR Camera Rig in the scene, with the transform of your controllers. or whatever tracking you would like to do. 

Don't forget to add the reference to the OVR Camera Rig inside your AvatarSDKManager, inside the Sample Input Manager component. 

I was about to just take one of the day sample scenes, and copy over the key game objects in place of the OVRig and XRRig. This worked for me.  Hope it works for you as it for sure works with controllers. 

I wasn't able to get my meta avatars to properly work with the OVRCameraRig and controllers with these steps but thanks for pointing me to the right script.

if (_ovrCameraRig)
{
inputTrackingState = new OvrAvatarInputTrackingState
{
headsetActive = true,
leftControllerActive = leftControllerActive,
rightControllerActive = rightControllerActive,
leftControllerVisible = false,
rightControllerVisible = false,
headset = _ovrCameraRig.centerEyeAnchor,
leftController = _ovrCameraRig.leftControllerAnchor,
rightController = _ovrCameraRig.rightControllerAnchor
};

// Fix to make the Meta Avatar work with controller and preexisting camera rig:
inputTrackingState.leftController.position = OVRInput.GetLocalControllerPosition(OVRInput.Controller.LTouch);
inputTrackingState.rightController.position = OVRInput.GetLocalControllerPosition(OVRInput.Controller.RTouch);
inputTrackingState.leftController.orientation = OVRInput.GetLocalControllerRotation(OVRInput.Controller.LTouch);
inputTrackingState.rightController.orientation = OVRInput.GetLocalControllerRotation(OVRInput.Controller.RTouch);

return true;
}

In SampleInputTrackingDelegate.cs I added some code to get the inputTrackingState to get the controller positions directly and that seems to have fixed my issue.

Hey! 

Did you add the reference inside the AvatarHorizonSdk? 

Yes, but the issue I was having was more extreme to begin with. When I switched from hand tracking to controllers, the arms would extend into the floor.

TheSeanLavery
Level 2

Has anyone got this to work as smooth as Meta Horizons avatars are?

 

The avatars do not move smoothly. Changing the update rate to send every frame makes the avatars move with a faster refresh rate, but it seems there is some jitter in the positions that are being sent/received.

 

Any help, trips, or tricks would be appreciated.

hari177
Level 2

I had the same issue. The solution by Astrologorithm worked for me. But then I found out removing the CameraRig reference in the SampleInputManager script and leaving it blank do not need any of the above code changes. It worked automatically. But I attached SampleAvatarEntity as a child of OVRCameraRig gameobject.