Incorrect eye offset with HMD after Rotation
I'm currently testing some things with the Oculus DK2 and UE4 4.7.5.
I'm trying to implement a simple view from a cockpit of a spacecraft. While the user camera is fixed to the cockpit, the cockpit itself need to be able to turn over three axis. The issue I'm encountering seems simple but I can't figure out how to solve it.
My issue is : when rotating the cockpit I can end up upside down. Meaning my head is down and my legs are up. In this situation I get an offset different for each eye and my vision is not synced anymore. From what I understand the HMD stays in World Space and therefore compute a wrong eye position (basically they are inverted).
This is easily visible with this image :
You can see that when I'm head down (the gray ground is on top of the image) the cockpit is offset away from the center of the screen on the left eye (while the inverse happens on the right eye).
My current code is very simple and I'm not sure what do to fix that. My camera is a camera component attached to my Character class. I retrieve the HMD rotation to rotate it in relative space. This allow me to get relative rotation what orientation the cockpit has.
A solution I saw was to set the World to Meters scale in the World properties of my scene to 1 instead of 100. Unfortunately while it fix the rotation issue (because the offset between the eyes almost doesn't change I believe), it makes my cockpit (and world) way too big. :)
Is there a way to handle the HMD in local space instead of world space ?
Okay I figured out why this was happening : basically I was rotating the camera via a custom UpdateRotation() override of the function present in the PlayerController class. By doing so I missed the part where I add to normalize the result of the rotation before feeding it to the HMD.
The exact process can be found in APlayerCameraManager::ProcessViewRotation() (which is called by UpdateRotation() ).
answered Apr 21 '15 at 05:57 PM
Follow this question
Once you sign in you will be able to subscribe for any updates here