Skip to main content
Up and Coming
January 4, 2015

Experimental changes in VR camera control

Happy New Year to everybody, btw!

Ok, the first cut is in GitHub:
https://github.com/Oculus-VR/UnrealEngine/tree/4.7-np

This is 4.7-preview with re-factored plugin and improved (I hope) camera control. I haven't added new Blueprint functions yet (like raw accel data or player's metrics, still in work). I am going to document all the changes (documentation is long due anyway)...

So, briefly. I've added PlayerController.bFollowHmd property, which is by default set to 'true' (for compatibility reasons). When it is set in 'true' then the behavior is the same as it was before: HMD drives PlayerController. You can either set it to 'false' or just don't bother, it will be set to false automatically, once you use PlayerCameraManager or CameraComponent approach.

The main approach you guys care the most (I think) is to enable HMD via CameraComponent. This class now has two additional boolean properties - bFollowHmdOrientation and bFollowHmdPosition. In addition, the scale of the CameraComponent now will be a scale of the position change / ipd. The bigger scale is set, the smaller world is perceived. Camera's origin is located in-between eyes, i.e. IPD will be applied at the camera's origin, half of IPD in positive Y-axis direction and another half in negative Y-axis direction (in camera coordinate system).

Besides CameraComponent, the PlayerCameraManager also has boolean properties bFollowHmdOrientation and bFollowHmdPosition. Thus, any camera attached to this PlayerCameraManager via SetViewTarget method will follow the HMD orientation and/or position.

In addition, the HeadMountedDisplay::GetOrientationAndPosition method now has two additional boolean parameters: bUseOrienationForPlayerCamera and bUsePositionForPlayerCamera (by default - both a set to 'false'). Set these to true, if you use this method to get HMD orientation/position to change the camera orientation / position manually. This is necessary to correctly calculate delta orientation/position for timewarp later on a render thread. However, there is no way to specify the proper scale to position in this case (should I add one more parameter to this method? With default value vector(1,1,1)? Probably, will think about this.)

So, if you, guys, have a look on these changes and try them I'd be grateful. I'll meet with Epic Games guys later this month and we will discuss these changes (however, Epic may suggest different approaches, different names for function/parameters, etc), so these changes are not final in any sense. Your opinion will be very important and will be considered in that discussion.
    This topic has been closed for replies.

    49 replies

    artyom17Author
    Up and Coming
    March 27, 2015
    I am supporting the 4.7-np branch, updating it to the latest 4.7.x releases. Behind the scenes, I am working on more code re-factoring, including GearVR. We also have discussed this with Epic guys. While they agree with the re-factoring efforts and with the whole idea to give more control over the camera, they took their time to think about better/other way to achieve this. Will see. We hope, those changes (combined with mine) will be in UE 4.8.

    Answering on your question. PlayerController always follows HMD position (once bFollowHmd is true), but only on view matrix stage. HMD position doesn't change the actual location of the camera/view point.

    I don't know all the details of the implementation of that leap motion controller stuff, but I assume you need to set bFollowHmdOrientation and bFollowHmdPosition to either the PlayerCameraContoller, or to the CameraComponent itself. In this case, PlayerController.bFollowHmd will need to be set to 'false' (actually, it should be automatically set to false... I guess).
    Up and Coming
    March 27, 2015
    Hi artyom, thanks for your answer.

    Just to clarify; what is the -np in 4.7-np?

    I am currently working on the 4.7.1 github build (with leap integration). I assume your build is behind this build yes? So I'm out of luck in terms of integration the two.

    Sadly, if I'm reading this correctly... without building your version, I will not be able to play with the "bFollowHmdPosition" functionality and the camera component.

    Is there a timeline you're willing to share for when you might have an updated version for 4.7.x? I'm incredibly glad you're taking the initiative to work on this - as it's the sort of feature that seems to me very important. Without it, it's rather difficult to build an experience that does NOT rely on the controller at all - and significantly limits the possibilities of development.

    I appreciate your work on this very much and thank you for your support to my questions. ^_^
    artyom17Author
    Up and Coming
    March 27, 2015
    Ah, I see. I just assumed, that if you post in this thread then you know what is the 4.7-np (-np stands for 'new plugin' :) ). It can be found here: https://github.com/Oculus-VR/UnrealEngine/tree/4.7-np It is currently 4.7.3-based.

    If you are using basically the out-of-the-box integration, then you may try to do the following. The PlayerCameraManager has the bFollowHmdOrientation member (that, basically enables both - orientation and position). Set it to true and check what happens.
    Up and Coming
    March 27, 2015
    Hi artyom,

    So would I need to build the 4.7-np github version to access the PlayerCameraManager > bFollowHmdOrientation? Or are you saying I can access that as is in the 4.7.1 unreal github build?

    Sorry if I am missing something; I am learning. <3
    artyom17Author
    Up and Coming
    March 27, 2015
    "STW" wrote:
    Hi artyom,

    So would I need to build the 4.7-np github version to access the PlayerCameraManager > bFollowHmdOrientation? Or are you saying I can access that as is in the 4.7.1 unreal github build?

    Sorry if I am missing something; I am learning. <3


    No, PlayerCameraManager -> bFollowHmdOrientation is already in your 4.7.1 integration .
    Up and Coming
    March 27, 2015
    Thank you artyom, appreciate your patience! I followed the instructions here : https://wiki.unrealengine.com/Oculus_Rift_Separate_View

    Created PlayerCameraManager, ticked FollowHMDOrientation.
    Created PlayerControler.
    Created Game Mode blueprint.

    Added the Leap component to the front of the camera in PlayerCameraManager blueprint. It is still not moving along with the HMD position. Am I missing something? Or is this something you can't troubleshoot without the Leap? Am I following the right mindset?

    Essentially though, whether it's the leap or not, whatever component should be following the position right? When I used the FirstPersonBlueprint with the Leap controller component in front of the camera, using WASD was fine and the Leap controller followed along with me.
    artyom17Author
    Up and Coming
    March 27, 2015
    Like I said, I am not familiar with the leap motion integration. Can you give me a link to github (if it is public to UE subscribers)?
    I think I know why it doesn't work, tho. And, unfortunately, I don't think the out-of-the-box integration will work. Because, it is not moving the camera physically, only the view matrix is updated.

    The experimental branch 4.7-np, though, does move the camera physically. So, I think, you indeed need to try to merge the leap motion integration with the 4.7-np.

    "STW" wrote:
    Thank you artyom, appreciate your patience! I followed the instructions here : https://wiki.unrealengine.com/Oculus_Rift_Separate_View

    Created PlayerCameraManager, ticked FollowHMDOrientation.
    Created PlayerControler.
    Created Game Mode blueprint.

    Added the Leap component to the front of the camera in PlayerCameraManager blueprint. It is still not moving along with the HMD position. Am I missing something? Or is this something you can't troubleshoot without the Leap? Am I following the right mindset?

    Essentially though, whether it's the leap or not, whatever component should be following the position right? When I used the FirstPersonBlueprint with the Leap controller component in front of the camera, using WASD was fine and the Leap controller followed along with me.
    Up and Coming
    March 27, 2015
    Great thank you again from prompt response! Then I will download the 4.7-np, try, and then report back :)

    The Leap integration was included in the official Unreal github repository build. Just not in the regular release of Unreal through the launcher.

    Link: https://forums.unrealengine.com/showthr ... post227875
    artyom17Author
    Up and Coming
    March 27, 2015
    Cool. I'll have a look. BTW, I found an issue with the current 4.7-np integration, seems like something was changed regarding to how camera calculates its Position/Orientation in the core (at some point). Looking into it right now.
    artyom17Author
    Up and Coming
    March 27, 2015
    "artyom17" wrote:
    Cool. I'll have a look. BTW, I found an issue with the current 4.7-np integration, seems like something was changed regarding to how camera calculates its Position/Orientation in the core (at some point). Looking into it right now.


    Fixed, btw.