0
\$\begingroup\$

Question:

For research purposes, I'm trying to lock the global camera yaw in VR -- though, the "how" is more of a 3D math question and has little to do with VR. The user is in control of the orientation of the headset, but I want to take control of the global yaw. To illustrate the movement the user is allowed:

enter image description here

What I've tried:

I've a number approaches, but so far each one has ended up distorting the camera's orientation in some way. My most recent attempt sets the euler y component of both global last/current head rotations to any arbitrary, but same, value so delta yaw between them is always 0. But, the result is weird looping behavior in the same global area -- irrespective of where yaw first locked -- while rotating my head in a straight line.

enter image description here

Edit: It appears as the global yaw approaches 180, it flips. With global pitch=0, this happens instantly at 180, but with non-zero values of pitch it starts earlier and the flip happens over time. Here is a clip that illustrates this behavior.

Implementation of this approach (in pseudo-code, as I'm not using a well-known development platform/API):

var lastWorldOrientation = getHMDOrientation();//This method returns world space orientation
var displayedOrientation = lastWorldOrientation;
void Update() {
    var nowWorldOrientation = getHMDOrientation();
    var delta;

    if (lockedYaw) { //null if not locked, else float with value yaw locked to
        var tempLast = lastWorldOrientation;
        var tempNow = nowWorldOrientation;
        tempLast.eulerAngles.y = lockedYaw;
        tempNow.eulerAngles.y = lockedYaw;
       
        delta = tempLast:toObjectSpace(tempNow);
    } else {
        delta = lastWorldOrientation:toObjectSpace(nowWorldOrientation);
    }

    lastWorldOrientation = nowWorldOrientation;
    displayedOrientation = displayedOrientation * delta;
    camera.rotation = displayedOrientation;
}

While all of my attempts have been manipulating the euler angles of the HMD / camera rotations, I also have the ability to manipulate and read them in quaternion or matrix form. Any ideas why the current approach I'm using experiences the distortion it does, and how I can lock the global yaw of the camera without interfering with the other two axes?

\$\endgroup\$
8
  • \$\begingroup\$ This is a very strange thing to do to a player - generally, anything we do to separate the actual rotation of the player's head from the rotation of the camera will quickly create discomfort and nausea. I presume there's a good reason you want to restrict this rotation, so can you tell us a bit about this? We might be able to find a different solution to the root problem without interfering with the player's sense of equilibrium. \$\endgroup\$
    – DMGregory
    Apr 24, 2017 at 0:53
  • \$\begingroup\$ @DMGregory Goal is to design a general-purpose VR movement system which can be applied to most games that doesn't restrict the player's movement (level size of play area), inhibit movement (teleportation), or cause nausea (joystick) for open world games. This is something tons of professionals currently working with VR haven't solved, so I'm not sure if a question of that scope is appropriate for SE. That being said, I'm open to suggestions. \$\endgroup\$
    – Drew
    Apr 24, 2017 at 4:01
  • \$\begingroup\$ For more info on the current approach, from the limited success I've had, allowing pitch/roll seems to alleviate a good bit of disorientation, and I imagine providing a 3D compass that does rotate and blurring out the rest of the world a slight bit would make this feasible. \$\endgroup\$
    – Drew
    Apr 24, 2017 at 4:01
  • \$\begingroup\$ How does disconnecting the movement of the player's head from the camera view help achieve this goal? If their yaw is locked, they can see only a subset of what they could with full head movement, so their freedom has only been reduced (something you cite as a negative for teleportation and roomscale), while also at least incrementally increasing nausea. If you're trying to protect the player from eg. fast-moving scenery to their sides which might cause unwanted vection, have you considered using adaptive blinders like in Eagle Flight, or a visible frame of reference cage? \$\endgroup\$
    – DMGregory
    Apr 24, 2017 at 4:09
  • \$\begingroup\$ @DMGregory The user approaches the boundary of the play space. They can turn around, but then they're going back to where they came from -- in the end, they can only go as far in the virtual world as the play space is in size. However, if the user hits the boundary, locks yaw, turns around 180 degrees, unlocks yaw, and then walks to the next boundary, they've just walked 2x the size of the play space in the same direction in the virtual world. Doing this allows them to walk infinitely in any direction in the virtual world. \$\endgroup\$
    – Drew
    Apr 24, 2017 at 5:08

0

You must log in to answer this question.

Browse other questions tagged .