Forum Discussion

🚨 This forum is archived and read-only. To submit a forum post, please visit our new Developer Forum. 🚨
hoesterey's avatar
hoesterey
Protege
12 years ago

Seperating Head and Mouse movement.

Hi,
Just picked up an Oculus Rift. I'm trying to separate the head movement from the mouse movement so my head movement doesn't effect the mouse movement.

The key is that when I turn my head I want the mouse to be "left behind". (basically a 3d scene cursor that represents my hand.)

Any clue how to accomplish this with Unity?

4 Replies

Replies have been turned off for this discussion
  • I haven't used the OVRPlayerController, only the OVRCameraController on my own character, but there is a setting on it, "Tracker Rotates Y". With this unchecked my Rift does not rotate the player, only the camera. And the mouse still rotates the player. Not sure how you would do it with the OVRPlayerController.
  • I got my rift last night, so I didn't mess in unity with it yet, but you could probably have a parent object be the object effected by movement, and set it's y rotation by mouse, then have the Rift controller be a child of that main object and only rotate the cameras.

    O-o don't know if that made sense, but think of the main object controlled by the mouse as a platform that the player stands on. When you use WASD it moves the platorm, when you turn the mouse left and right, it turns the platform. When the player looks around, they simply look around.

    O-o.............................................. Did any of that make sense? (I'm not sure how the Rift controller works since I haven't messed with it, but you could probably strip out the default movement system if it has one.)





    EDIT:
    (You could possible also add an offset value that the mouse adds to to the rotation of the camera. This is probably simpler as it's just a single value that gets the Input.GetAxis("Mouse Y") added to it. Again, I'm not sure how the controller works, so I don't know if you'd have to add the offset every frame, or if you would simply add the mouse axis input.)
  • Thanks for the replies.

    Just to be clear. the problem I'm having is not that the mouse moves the camera it doesn't

    The problem is the camera moves the mouse. E.g. if the mouse pointer is center screen and I turn my head the mouse pointer stays center screen. I want it to stay where it would have been in 3d space.

    It seams that the Oculus head movement maps to the "Mouse X" and "Mouse Y" inputs in unity, so when I turn my head the mouse inputs have value. Sadly I can't find anyway to change this.

    I tried the parenting trick but that didn't seam to work. Also tried the Track Y setting.

    The thing is anything I control with mouse movement thinks I'm moving the mouse when I move the Oculus. I can't figure out how to map the oculus to a different input.
  • Figured it out.

    I set the Oculus Cameras to not be "Main" then created another camera that is just "Main" Apparently the mouse input is driven by the Main camera rotation. :)

    Thanks!