Download

Camera in First Person for VR

Hi guys, I have an interesting mechanic in mind but I’m not sure how I would go about creating it, so I’m hoping you guys can point me to some reference material that may cover the basics or specifics, even.

So let’s use a First Person VR game as an example. You can use the mouse to look around, you can also look around with your head.
If you want to shoot at something, you’re likely going to be aiming it down with your head (or mouse) to do so.

Now in my case, I want to create an RPG type first-person, similar to Skyrim (for example).
I want to make it so that the head movement does NOT influence the cross-heirs / focal point. Instead, I want to use the mouse for precision firing (of a spell, for example).
However, if the mouse reaches a certain point in any direction, it will start to force the head / camera to move slowly with it, as if it were dragging a boundary.
So you would always have a certain window of opportunity in front of you in which to aim your mouse around and have the hand with a spell or sword follow it around to stay accurate with the cross-heirs, but you’d be
free to look around without forcing the head movements with the mouse. Similarly, if you move the head to a certain point in any direction, it would force the mouse to move in that direction as if dragging an invisible boundary.

I hope I explained this well enough - but it would essentially eliminate the need to aim down with your head and give the players a better, more immersive experience where they can feel like they are in control
of two separate things - their hands/actions and their head movements, rather than using the head + mouse for the same purpose.

https://youtube.com/watch?v=aoF3dPNhApU
That’s kind of what I’m doing in my game, but not quite. I’m supporting mouse and keyboard as a redundant fall back for players which don’t have motion controllers.

You look at where you want to shoot (generally). You fire with your mouse buttons. Left mouse = left hand, right mouse = right hand. You rotate the characters yaw with the mouse, but use your head to pitch and look around.

If you’re using motion controllers or hands instead, then I completely ignore the gaze vector for targeting.

Instead of doing a line trace from the camera to the target, do a line trace from the weapon to the target. Then use the mouse (or right axis button) to move the weapon / cross hair. Combine that with some IK to make the character animate correctly, and there you go.