Forum Discussion

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

Unity: 1 unit = 1 metre. Very important!

It took me awhile to figure out why everything in my project looked sort of flat in the rift, while other people's demos really popped out at you. I had made a noob mistake and built my scene in Unity using centimetres instead of metres. Now, while everything looked to scale, the trouble was when Unity fetched my ipd it was 100 times too small. This effectively gave a zero IPD, so the left and right eye images were identical. Rather than rescaling my entire scene I just added a fudge factor to the camera controller script.
If anyone else does something similarly stupid, like using inches or feet, here's how to easily fix it.

Edit the OVRCameraController.cs script. In void UpdateCameras add a multiplier factor to the eye position offset (in my case 100):

float distOffset = 0.5f + (LensOffsetLeft * 0.5f);
float perspOffset = LensOffsetLeft;
float eyePositionOffset = -IPD * 100 * 0.5f;
ConfigureCamera(ref CameraLeft, distOffset, perspOffset, eyePositionOffset);

distOffset = 0.5f + (LensOffsetRight * 0.5f);
perspOffset = LensOffsetRight;
eyePositionOffset = IPD * 100 * 0.5f;
ConfigureCamera(ref CameraRight, distOffset, perspOffset, eyePositionOffset);

And that's it - I hope someone finds it useful.

34 Replies

Replies have been turned off for this discussion