Forum Discussion
JohnDe
11 years agoHonored Guest
Set Rotation in Unity with OVR 5.0.1
Hello,
i was reading a lot of posts but i cannot find a way to set the orientation of the oculus. I have an avatar with the following structure:
The neck follows always the CenterEyeAnchor of the OVRCameraRig and the OVRCameraRig gets the position of oculusPosition.
Unfortunately OVRManager.display.RecenterPose() sets the yaw rotation only. I've tried to take the difference of the new rotation and CenterEyeAnchor rotation and added it to the OVRCameraRig. But sometimes the rotation error gots bigger and bigger.
Here a short code snippet:
Somebody has an idea what i'm doing wrong?
What is the right way to set the rotation?
Thanks!
i was reading a lot of posts but i cannot find a way to set the orientation of the oculus. I have an avatar with the following structure:
Avatar
+ ...
+ OVRCameraRig
| + TrackingSpace
| + LeftEyeAnchor
| + CenterEyeAnchor
| + ...
+ neck
+ oculusPosition
The neck follows always the CenterEyeAnchor of the OVRCameraRig and the OVRCameraRig gets the position of oculusPosition.
Unfortunately OVRManager.display.RecenterPose() sets the yaw rotation only. I've tried to take the difference of the new rotation and CenterEyeAnchor rotation and added it to the OVRCameraRig. But sometimes the rotation error gots bigger and bigger.
Here a short code snippet:
void LateUpdate()
{
neck.rotation = centerEyeAnchor.rotation * oculusInNeckRot;
ovrCameraRig.position = oculusPosition.position;
}
void SetRotation(Quaternion newRotation)
{
ovrCameraRig.rotation *= Quaternion.Inverse(centerEyeAnchor.rotation) * newRotation;
}
Somebody has an idea what i'm doing wrong?
What is the right way to set the rotation?
Thanks!
1 Reply
- JohnDeHonored GuestFor those with the same problem, i've found a way to fix it:
void LateUpdate()
{
neck.rotation = centerEyeAnchor.rotation * oculusInNeckRot;
ovrCameraRig.position = oculusPosition.position;
}
void SetRotation(Quaternion newRotation)
{
ovrCameraRig.rotation = newRotation * Quaternion.Inverse(leftEyeAnchor.rotation) * ovrCameraRig.rotation;
}
It seems to be important to take the LeftEyeAnchor instead of the CenterEyeAnchor.
Regards!
Quick Links
- Horizon Developer Support
- Quest User Forums
- Troubleshooting Forum for problems with a game or app
- Quest Support for problems with your device
Other Meta Support
Related Content
- 5 months ago
- 4 years ago