Showing results for 
Search instead for 
Did you mean: 

Limit Head Rotation Unity 5.x

Hey guys,

I have a quick question for you! I've looked around the forum, but I wasn't able to find a clear solution.

I need to limit the rotation of the OVR object inside Unity and this is due to a very linear purpose:

-The player's POV is inside a power armour with a fixed helmet. His in-game body is also locked into position. Movement rotation is part of the gameplay and is handled by the controls.

So, allowing the player to rotate the POV beyond the character's neck limit would be silly (since it would be an unnatural movement on the game's context) and rotating the body along with the head movement kind of messes with our gameplay.

What I needed was to allow about 80º to 90º worth of rotation, enough for the player to see a bit of the helmet's inside and realize he can't look no further. The same logic could be applied to limit flexion radious to about 60º to 70º, again enabling the player to take a glimpse of the helmet's interior on the upwards and downwards direction.

Under the context of my game, this would be a strong immersion enabler, since it would perfectly convey the "armour confinement" feeling I need.

Now, I've seen a couple of approaches to this problem, some messier than others, but I was looking for a "proper" way to tackle this instead of mutilating/refactoring my way through the OVR utilities code.

Can anyone help me out or point me at the right direction?

I thank you guys in advance for the help!

Grand Champion
No, you should never limit head rotation as it will make users uncomfortable.

Honored Guest
Never limit head rotations, Allow the movement, but possibly fade the screen out when rotating too far, or some other non-painful way to direct the attention forward

Hey, thanks for the tip!

The fade out solution seems good, specially if it kicks-in if the rotation goes above the "natural" angles for neck movement.

In fact a additive fade-out, regulated by the offset from the rotation limits could actually be an elegant approach to this.

So, how does one implement this on Unity 5.x? Will the OVR play nice with a fade-out effect?

I'm guessing that I would need to compare current OVR rotation with an target and if >= start the fade-out until reaching full black?

Are there any examples of this approach?

Grand Champion
Yes, I believe the Room scene that comes with the Oculus Utilities does this (it shows an arrow texture, but you could replace with a black square).

Honored Guest
What you have is a typical cockpit setup.
Just model the mech helmet with a fixed view port.
When Im in the mech and I look to the right I see the right view edge of the port, further to the right I might see some useful controls, indicators, maybe a photo of my girl... use what you previously perceived as a limitation to become a cool feature.

you feel me?