Hi there,
In my current example, the player can walk over a slowly rotating platform, so it’s current viewing angle should change accordingly like in real life. This works well in non-VR.
In VR, however, the current viewing angle seems 1:1 mapped to the headtracking-data. So the platform rotates but the player is continuously facing the SAME direction (which is wrong of course).
I currently fixed this by checking if the player is currently standing on the platform and in this case manually adding the current yaw difference per ‘add yaw input’ and multiplying the value with 0.4 (for whatever reason) if in VR-mode:
How to do it the proper way? Thank you!
Engine Version: 4.7.3
So, can you at least confirm that this is a bug…?
EDIT: Hello…?
Ok, after a few days of fiddeling around I at least found the reason for the weird scale factor of 0.4:
UE4s default player controller scales all yaw values with 2.5 for whatever reason which screws up pretty much all rotation commands in my project.
Solution:
- Create a new BP and derive from “PlayerController”.
- Change “Input Yaw Scale” to 1.0 (instead of 2.5)
- Set this Blueprint as ‘player controller class’ in the world settings of your project or alternatively in your active GameMode
I still have to manually add the rotation of the platform under the player to the yaw of the camera…
Update: Still not fixed in 4.8.1, created and uploaded a test project:
This is how your blueprint should look like (4.8.x) to make camera to follow the platform’s rotation:
Begin Object Class=K2Node_Event Name="K2Node_Event_255"
Begin Object Class=EdGraphPin Name="EdGraphPin_678"
End Object
Begin Object Class=EdGraphPin Name="EdGraphPin_679"
End Object
Begin Object Name="EdGraphPin_678"
PinName="OutputDelegate"
Direction=EGPD_Output
PinType=(PinCategory="delegate",PinSubCategoryMemberReference=(MemberParent=Class'/Script/Engine.Actor',MemberName="ReceiveBeginPlay"))
End Object
Begin Object Name="EdGraphPin_679"
PinName="then"
Direction=EGPD_Output
PinType=(PinCategory="exec")
LinkedTo(0)=EdGraphPin'K2Node_CallFunction_3224.EdGraphPin_684'
End Object
EventReference=(MemberParent=Class'/Script/Engine.Actor',MemberName="ReceiveBeginPlay")
bOverrideFunction=True
Pins(0)=EdGraphPin'EdGraphPin_678'
Pins(1)=EdGraphPin'EdGraphPin_679'
NodePosX=464
NodePosY=-1728
NodeGuid=B837783E41394CD92756D485295CF53D
End Object
Begin Object Class=K2Node_CallFunction Name="K2Node_CallFunction_3224"
Begin Object Class=EdGraphPin Name="EdGraphPin_684"
End Object
Begin Object Class=EdGraphPin Name="EdGraphPin_685"
End Object
Begin Object Class=EdGraphPin Name="EdGraphPin_686"
End Object
Begin Object Class=EdGraphPin Name="EdGraphPin_687"
End Object
Begin Object Class=EdGraphPin Name="EdGraphPin_688"
End Object
Begin Object Name="EdGraphPin_684"
PinName="execute"
PinType=(PinCategory="exec")
LinkedTo(0)=EdGraphPin'K2Node_Event_255.EdGraphPin_679'
End Object
Begin Object Name="EdGraphPin_685"
PinName="then"
Direction=EGPD_Output
PinType=(PinCategory="exec")
LinkedTo(0)=EdGraphPin'K2Node_CallFunction_2275.EdGraphPin_20221'
End Object
Begin Object Name="EdGraphPin_686"
PinName="self"
PinFriendlyName="Target"
PinToolTip="Target\nOculus Function Library Reference"
PinType=(PinCategory="object",PinSubCategoryObject=Class'/Script/OculusRift.OculusFunctionLibrary')
DefaultObject=Default__OculusFunctionLibrary
bHidden=True
End Object
Begin Object Name="EdGraphPin_687"
PinName="bFollowHmdOrientation"
PinToolTip="Follow Hmd Orientation\nBoolean\n\n(in) True if camera\'s orientation should be updated by most recent HMD orientation."
PinType=(PinCategory="bool")
DefaultValue="true"
AutogeneratedDefaultValue="false"
End Object
Begin Object Name="EdGraphPin_688"
PinName="bFollowHmdPosition"
PinToolTip="Follow Hmd Position\nBoolean\n\n(in) Whether the camera\'s position should be updated by most recent HMD orientation or not."
PinType=(PinCategory="bool")
DefaultValue="true"
AutogeneratedDefaultValue="false"
End Object
FunctionReference=(MemberParent=Class'/Script/OculusRift.OculusFunctionLibrary',MemberName="EnablePlayerCameraManagerFollowHmd")
Pins(0)=EdGraphPin'EdGraphPin_684'
Pins(1)=EdGraphPin'EdGraphPin_685'
Pins(2)=EdGraphPin'EdGraphPin_686'
Pins(3)=EdGraphPin'EdGraphPin_687'
Pins(4)=EdGraphPin'EdGraphPin_688'
NodePosX=656
NodePosY=-1728
NodeGuid=FD8126CD49F2DE30234051AE6382A888
End Object
Begin Object Class=K2Node_CallFunction Name="K2Node_CallFunction_2275"
Begin Object Class=EdGraphPin Name="EdGraphPin_20221"
End Object
Begin Object Class=EdGraphPin Name="EdGraphPin_20222"
End Object
Begin Object Class=EdGraphPin Name="EdGraphPin_20223"
End Object
Begin Object Class=EdGraphPin Name="EdGraphPin_20224"
End Object
Begin Object Name="EdGraphPin_20221"
PinName="execute"
PinType=(PinCategory="exec")
LinkedTo(0)=EdGraphPin'K2Node_CallFunction_3224.EdGraphPin_685'
End Object
Begin Object Name="EdGraphPin_20222"
PinName="then"
Direction=EGPD_Output
PinType=(PinCategory="exec")
LinkedTo(0)=EdGraphPin'K2Node_VariableSet_38.EdGraphPin_20245'
End Object
Begin Object Name="EdGraphPin_20223"
PinName="self"
PinFriendlyName="Target"
PinToolTip="Target\nOculus Function Library Reference"
PinType=(PinCategory="object",PinSubCategoryObject=Class'/Script/OculusRift.OculusFunctionLibrary')
DefaultObject=Default__OculusFunctionLibrary
bHidden=True
End Object
Begin Object Name="EdGraphPin_20224"
PinName="bEnable"
PinToolTip="Enable\nBoolean"
PinType=(PinCategory="bool")
DefaultValue="false"
AutogeneratedDefaultValue="false"
End Object
FunctionReference=(MemberParent=Class'/Script/OculusRift.OculusFunctionLibrary',MemberName="EnablePlayerControllerFollowHmd")
Pins(0)=EdGraphPin'EdGraphPin_20221'
Pins(1)=EdGraphPin'EdGraphPin_20222'
Pins(2)=EdGraphPin'EdGraphPin_20223'
Pins(3)=EdGraphPin'EdGraphPin_20224'
NodePosX=1008
NodePosY=-1728
NodeGuid=6F53EAD34BFD37EB5A064EAD82817DC4
End Object
Begin Object Class=K2Node_CallFunction Name="K2Node_CallFunction_2276"
Begin Object Class=EdGraphPin Name="EdGraphPin_20225"
End Object
Begin Object Class=EdGraphPin Name="EdGraphPin_20226"
End Object
Begin Object Class=EdGraphPin Name="EdGraphPin_20227"
End Object
Begin Object Class=EdGraphPin Name="EdGraphPin_20228"
End Object
Begin Object Name="EdGraphPin_20225"
PinName="self"
PinFriendlyName="Target"
PinToolTip="Target\nGameplay Statics Reference"
PinType=(PinCategory="object",PinSubCategoryObject=Class'/Script/Engine.GameplayStatics')
DefaultObject=Default__GameplayStatics
bHidden=True
End Object
Begin Object Name="EdGraphPin_20226"
PinName="WorldContextObject"
PinToolTip="World Context Object\nObject Reference"
PinType=(PinCategory="object",PinSubCategoryObject=Class'/Script/CoreUObject.Object')
bHidden=True
End Object
Begin Object Name="EdGraphPin_20227"
PinName="PlayerIndex"
PinToolTip="Player Index\nInteger"
PinType=(PinCategory="int")
DefaultValue="0"
AutogeneratedDefaultValue="0"
End Object
Begin Object Name="EdGraphPin_20228"
PinName="ReturnValue"
PinToolTip="Return Value\nPlayer Camera Manager Reference"
Direction=EGPD_Output
PinType=(PinCategory="object",PinSubCategoryObject=Class'/Script/Engine.PlayerCameraManager')
LinkedTo(0)=EdGraphPin'K2Node_VariableSet_38.EdGraphPin_20248'
End Object
bIsPureFunc=True
FunctionReference=(MemberParent=Class'/Script/Engine.GameplayStatics',MemberName="GetPlayerCameraManager")
Pins(0)=EdGraphPin'EdGraphPin_20225'
Pins(1)=EdGraphPin'EdGraphPin_20226'
Pins(2)=EdGraphPin'EdGraphPin_20227'
Pins(3)=EdGraphPin'EdGraphPin_20228'
NodePosX=1024
NodePosY=-1584
NodeGuid=61BDC75B4FF9F4CC59DDD29A159A36E7
End Object
Begin Object Class=K2Node_VariableSet Name="K2Node_VariableSet_38"
Begin Object Class=EdGraphPin Name="EdGraphPin_20245"
End Object
Begin Object Class=EdGraphPin Name="EdGraphPin_20246"
End Object
Begin Object Class=EdGraphPin Name="EdGraphPin_20247"
End Object
Begin Object Class=EdGraphPin Name="EdGraphPin_20248"
End Object
Begin Object Class=EdGraphPin Name="EdGraphPin_20249"
End Object
Begin Object Name="EdGraphPin_20245"
PinName="execute"
PinType=(PinCategory="exec")
LinkedTo(0)=EdGraphPin'K2Node_CallFunction_2275.EdGraphPin_20222'
End Object
Begin Object Name="EdGraphPin_20246"
PinName="then"
Direction=EGPD_Output
PinType=(PinCategory="exec")
End Object
Begin Object Name="EdGraphPin_20247"
PinName="bFollowHmdOrientation"
PinType=(PinCategory="bool")
DefaultValue="true"
AutogeneratedDefaultValue="false"
End Object
Begin Object Name="EdGraphPin_20248"
PinName="self"
PinFriendlyName="Target"
PinType=(PinCategory="object",PinSubCategoryObject=Class'/Script/Engine.PlayerCameraManager')
LinkedTo(0)=EdGraphPin'K2Node_CallFunction_2276.EdGraphPin_20228'
End Object
Begin Object Name="EdGraphPin_20249"
PinName="Output_Get"
PinToolTip="Retrieves the value of the variable, can use instead of a separate Get node"
Direction=EGPD_Output
PinType=(PinCategory="bool")
DefaultValue="false"
AutogeneratedDefaultValue="false"
End Object
VariableReference=(MemberParent=Class'/Script/Engine.PlayerCameraManager',MemberName="bFollowHmdOrientation")
SelfContextInfo=NotSelfContext
Pins(0)=EdGraphPin'EdGraphPin_20245'
Pins(1)=EdGraphPin'EdGraphPin_20246'
Pins(2)=EdGraphPin'EdGraphPin_20247'
Pins(3)=EdGraphPin'EdGraphPin_20248'
Pins(4)=EdGraphPin'EdGraphPin_20249'
NodePosX=1328
NodePosY=-1712
NodeGuid=9B492EC64BC38A16C2D1FBA2B938EC82
End Object
Don’t get why we need all these nodes except last one?
And why we are enabling follow HMD orientation? I know it works but don’t get why that flag has inverted logic?
Long story short: It’s pretty much broken right now. See https://forums.oculus.com/viewtopic.php?f=60&t=24683 for reasons.
Currently, we can’t do much than vote for Trello
Hi there, Thanks for the solution. Sadly it creates an error in Unreal 4.10 once you package the project or reopen it. Se the Screenshot for details:
Once I remove the blueprint everything works fine again.
I use unreal 4.10 and the Oculus SDK 0.8.0.0. Does anyone have a solution for the problem?
You need to recreate that blueprint manually using the blueprint editor rather than pasting that text. Seems like pasting may work only while you stay on the same version of UE.
Thanks for the superfast answer. I did recreate it by manually building it with the blueprint editor. Do you have any other suggestions?
Just tried it and it works for me…
Thanks again for the answer! I did a bit of testing and found out, that the problem I described occurred when you use the first person c++ template. With the blueprint template it works. Not sure if that can be considered a bug or if I really just shouldn’t mix C++ with blueprints.
… or maybe the long-awaited camera-refactoring should finally be implemented. This was done by Oculus many months ago but rejected by Epic: https://forums.oculus.com/viewtopic.php?f=60&t=24683#p283597
Seriously, is there any none left who fully understands all the different working, partially- and non-working rotation-options? AFAIK followHmdPosition still doesn’t work in the camera manager.
[Unreal 4.11]
For the new unreal version, this solution doesn’t work anymore. I found a clean way to do it anyways:
First, deactivate “Lock to HMD” in the camera you are using.
Now, whenever you want to rotate the HMD you have to use the function “Set Base Rotation and Base Offset in Meters” with the parameter rotation… obviously.
I hope this saves some stress for someone upgrading to the new version