cancel
Showing results for 
Search instead for 
Did you mean: 

First person with head movement

AdamL288
Honored Guest
Hi all,

Bit of a tricky question here I fear. But it may not be so as I've seen it done in a few demos, and I'm still fairly new to Unity. Basically, I am trying to program a first person game with Rift support in mind. In this game I want to render the main character under the camera so that you can see your 'body' using the Rift. I've also implemented a large mirror to test if this works. My setup is as follows:

- Player object (mesh, controller and animations) + first person controller scripts from the standard assets pack
-- OVRCameraController attached to the head
--- Invisible target object parented a distance away from the head (rotates with the head movement)

This setup works as far as simple walking/running/jumping animations, but moving the camera doesn't affect the mesh in any way. So I found a head movement script from here: http://blogs.unity3d.com/2009/07/10/just-looking-around/ which is designed with third person games in mind. I attached this to my player and set the invisible target object as the target transform, then adjusted the following values in the script (see the above link for reference on what each one does):

- First transform: neck
- Last transform: head
- Threshold angle difference: 0 (no minimum angle before movement occurs)
- Bending multiplier: 1 (head should always look directly at target)
- Max angle difference: 90 (default, shouldn't make a difference as this will never be reached)
- Max bending angle: 80 (degrees in each direction)
- Responsiveness: 100 (no delay in head tracking)

However, nothing appears to be happening. I'm wondering if anyone has used this script in their game before, or whether there is another method I can try? For an example of what I'm after, the Minecrift implementation is perfect. And though I haven't tried it yet, I imagine the Tuscany girl demo would have the same setup.

Any thoughts? Thanks in advance!

Adam ~
3 REPLIES 3

drash
Heroic Explorer
I don't currently have a chance to drill down too deep into the details of your post, although I did scan through it and the link to the script. Is it possible that your script is assuming that OVRCameraController is going to rotate according to the Rift headtracking? Because, it won't -- the effective rotation can only be seen in the rotations of the CameraLeft/CameraRight children of the camera controller.

Sorry I couldn't be more thorough. Good luck!

AdamL288
Honored Guest
Thanks for the reply! I did think about this - my setup also contains a toggle camera script where the 'C' key is pressed to switch between the OVR camera and a standard one attached to the player in the same way. This lets me test the game using mouselook in Y as well as X. Even when this script is used on the normal camera object nothing happens.

Krisper
Explorer
Its a bit hard to say without seeing how the character is set up but you should be able to rotate the characters head or neck bone using the OVR Right Cameras local rotation.