Successes This Week
Smooth Elevator Rides
Ever since I joined to develop on PHOBOS, riding both the internal and external AMVR tower elevators at times had very up and down jittering experiences, and for a long time, I could not figure the cause of it. No colliders were rubbing against each other between the elevators and walls. The algorithm for moving the elevators relied on Unity’s Fixed Update method. Luckily, I found a solution that allows a very smooth non-jittery ride from ground floor to the rooftop. To remove the jittering, I made the elevator a parent of the player game object when entering the elevator’s trigger zone, and unparenting when the player leaves that trigger zone.
How to Avoid Clipping Objects
One of the problems with positional tracking is if the user physically moves away from the tracking camera even by a little (or simply move their head in a certain direction), the user may clip the walls, avatars, and any nearby game object intentionally or accidentally. In the picture below, you can see the Character Controller (which has a Capsule Collider) that shows where the user should be in the world. However, because of positional tracking enabled, the camera as shown inside the sphere collider bounds (trigger mode enabled) is free to go beyond where the player should be in the world. If this sphere is outside the capsule collider for example, when turning, the camera will not rotate in place as expected, which could put the user unexpectedly clipping something. Rather than shifting the user away from a colliding object (could make user sick) to avoid clipping, some in the VR community have suggested fading the field of view to black until the user moves into a position in which clipping does not occur, in which case the fading gradually disappears. This was easy to implement using the sphere collider component in trigger mode attached to the CenterEyeAnchor game object node of the OVRPlayerController and a script. After experimenting a few times by using an Oculus Rift CV1 putting my head into walls, avatars, and any visible collider object, the frequent blacking out of the screen, comfortable at first, was really messing with my brain. I decided against this approach as well. Instead, the best solution I think is to avoid the clipping situation as much as possible by first making sure the virtual camera (sphere collider) is aligned with the user position (capsule collider) in the world (that means making sure the user is directly in front of the tracking camera at the right distance in the real world). I have a clip avoidance script attached to the CenterEyeAnchor game object node, the important part as shown below the pictures. I determined my own acceptable bounds for user position in front of the tacking camera rather than the real frustrum bounds for tracking. This makes sure the user’s camera essentially rotates in-place when the user turns his or her body without clipping anything if the user stands up straight. I use a white circle to indicate the tracking camera’s position currently in the virtual world and physically in the real world. I enable the circle’s (really a 3D sphere in world space) visibility when the user is outside my defined bounds, and disable the mesh component when within my defined bounds.
I hope Oculus can provide us several built-in options in future versions of OVR Utilities package for handling the object clipping problem and encouraging the person to stay in acceptable bounds and distance in front of the tracking camera.
Another way to avoid object clipping is to increase the collider size such that it is difficult to put my head in it. Thus, some stationary avatars had their capsule collider radiuses increased.
Furthermore, I could decrease the near clipping plane value of the user’s view frustrum. However, in this city environment, decreasing this value is a tradeoff to texture flickering everywhere in the city – which was really bad. Reluctantly, I had to actually increase this value until the flickering stopped.
AMVR tower has so many flaws but many are now fixed.
- Tower doors on every floor are now bigger and realistic when compared to user’s height. The simple solution here was adjusting the texture tiling of the material.
- I rescaled the indoor elevator size so as to fit between tower floors without forcing the user to squat inside the elevator. Also, the floor numbers are now counted correctly (e.g. floor 3 is not floor 5 anymore) and all are accounted for.
- I added an elevator shaft to the AMVR tower and filled in the unsightly gaps, so it looks much better.
In the city’s park, the bird simulation was updated such that the bird size range was reduced (some were as big as chickens), and bird flight speed was again reduced drastically to look normal.
I also positioned the text panel where messages are displayed closer (for easier reading) and at a 45 degree angle so as to not directly obstruct the view straight ahead. The text font was changed for easier reading as well. Message sentences were simplified (made shorter) and broken into more lines to make them easier to read at their new position relative to user’s camera.