Forum Discussion
drash
12 years agoHeroic Explorer
Scaling and OVRCameraController
Hi, just wanted to mention that when the OVRCameraController is inside a hierarchy such that the "eyes" should be scaled up or down to something other than 1.0, it adversely affects the eye separation for the two cameras. For example if my player is inside a scene that is scaled down to 0.001 of original size just to keep world coordinates from getting too big, the player's effective IPD ends up being 64 meters instead of 64mm.
I had to make the following changes to fix this (but use at your own risk in case it breaks something elsewhere). I am simply making the eye separation code operate in local space instead of world space. Near the bottom of SetCameraOrientation() in OVRCamera.cs, these two lines:
...should be changed to this:
EDIT: This was not a good fix. See my next post below for a better fix.
I had to make the following changes to fix this (but use at your own risk in case it breaks something elsewhere). I am simply making the eye separation code operate in local space instead of world space. Near the bottom of SetCameraOrientation() in OVRCamera.cs, these two lines:
// Update camera position (first add Offset to parent transform)
gameObject.camera.transform.position = gameObject.camera.transform.parent.transform.position + NeckPosition;
// Adjust neck by taking eye position and transforming through q
gameObject.camera.transform.position += q * EyePosition;
...should be changed to this:
// Update camera position (first add Offset to parent transform)
gameObject.camera.transform.localPosition = gameObject.camera.transform.parent.transform.localPosition + NeckPosition;
// Adjust neck by taking eye position and transforming through q
gameObject.camera.transform.localPosition += q * EyePosition;
EDIT: This was not a good fix. See my next post below for a better fix.
2 Replies
Replies have been turned off for this discussion
- cyberealityGrand ChampionInteresting. Thanks for posting a fix.
- drashHeroic ExplorerJust an update. This turned out to NOT a good fix to account for the player being scaled differently. The fix I posted in the first post results in a stereoscopic image that looks fine when facing straight ahead but when you look left or right, your eyes are no longer moving around the center of your head correctly. It's as if one eye is moving backward and the other eye is moving forward and makes close-range stereoscopy very uncomfortable.
So I changed it back, but then added a scale multiplier instead:// Update camera position (first add Offset to parent transform)
gameObject.camera.transform.position = gameObject.camera.transform.parent.transform.position + NeckPosition * gameObject.camera.transform.lossyScale.z;
// Adjust neck by taking eye position and transforming through q
gameObject.camera.transform.position += q * (EyePosition * gameObject.camera.transform.lossyScale.z);
The in-game result looks MUCH better now. :)
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
- 7 months ago
- 9 months ago
- 6 months ago