googlevr / cardboard

Open source Cardboard SDK and samples
Other
1.48k stars 253 forks source link

Limit Rotation #272

Open Mashimaro7 opened 3 years ago

Mashimaro7 commented 3 years ago

Hello, I wonder if there's any way to limit rotation? I know this has been asked before, but I haven't really found a satisfactory solution. I'm making a VR game in Unity, and there are multiple issues that occur because the rotation is not limited.

For one, when the character is sitting in a chair, they can turn around and see their head(I had a previous model where the head was a separate object, so I just disabled it, but the current model doesn't have them separated).

For another, the body follows the rotation of the camera, and if the player looks down too far, the body rotates as if you were facing backwards, the easiest solution would be to limit the X rotation of the camera to 85 degrees or something.

I know, Google doesn't like people limiting rotation, I only want to limit it slightly. I just want to make it so you can't turn 180 degrees while sitting(in other words, only allow you to view 120 degrees or maybe a little more to the left or right, but not turn 180 degrees around to be facing backwards as you cant really do that without positioning your body awkwardly while sitting anyway), and so you can't look too far down. It's a VR chat style game, there will be a few different models, I would rather not have to design some sort of hack for each of them, I will have to make the head follow the camera rotation eventually, and that creates another issue while sitting where you can exorcist style turn your head 360 degrees lol

whizzkid commented 3 years ago

It's not because Google doesn't like it, it's because this will make the user motionsick very fast.

You'd be better off turning off the display or showing a message for the user to face forward again if they rotate too far. (or hiding the body object if the user is looking in the wrong direction)

As for the other players' avatars, you can stop their heads from rotating too far, just don't mess about with your players camera rotation.

Mashimaro7 commented 3 years ago

It's not because Google doesn't like it, it's because this will make the user motionsick very fast.

I understand that, but I don't think limiting the X axis to 85 degrees or limiting horizontal rotation while sitting will make people motion sick, it's a VR chat like game, why would people be looking straight down haha. It seems like adding a black screen would be very intrusive... Same for sitting in a chair, I don't know why people would rotate 180 degrees to look backward.

Also, it's not other avatars i want to limit, it's the main player's.

So, is there just a way to limit the rotation? If I make my users motion sick I'll deal with that later, I don't think it will be that big of a deal. It's only while they are sitting in a chair.

Mashimaro7 commented 3 years ago

Bump?

jballoffet commented 3 years ago

Thank you reaching out to us. Currently, the Cardboard SDK doesn’t have a built-in rotation limit setting and there are currently no plans to include it. However, adding support for it may be considered in a future update. In the meantime, you could perform the rotation limit on the application side (like @whizzkid pointed out), or you could add a rotation limit in the HeadTracker module, within the SDK (see https://github.com/googlevr/cardboard/blob/dcdd0929388f7cf27eccc10f97baff51b172d7d3/sdk/head_tracker.cc#L71). In case you would like to send your proposed changes, please read CONTRIBUTING.md and follow the process. Patches are welcome.