I created a UMG ‘Menu’ widget and added this to a blueprint.
Now I’m trying to spawn this blueprint in front of where the HMD is looking, however when referencing the rotation the menu does not spawn at all.
I tried everything Camera Get Word Rotation, Get Orientation and Postion.
Note: The menu should be an overlay where the person is looking and not be locked to the Viewport / Camera.
Note 2: It also seems to spawn behind me, which can be fixed by changing the Vector*Float to a negative value, I just wonder why this occurs.
Okay I finally found and fixed this issue, however the code is ugly as hell.
It seems that all the Rotation methods, like GetWorldRotation, HMD>GetOrientationAndPosition
Return exactly the opposite values, at least for the YAW value.
When it’s:
0 it should be 180 or -180
90 it should be -90
180 it should be 0
-90 it should be 90
-180 it should be 0
So the only way I could find to gt around this was to add an if that when
return value => 0, do value - 180
returnvalue < 0, do value +180
Now this does result in allot of duplicate code, since the Add and Subtract functions don’t support those White Lines.
Please suggest a better solution for this or fix this bug.
As Koralgoll pointed out, the much simpler solution is to attach your menu to the player, and set visibility when paused/unpaused. Also, I’ve done the same thing in my own project, and the menu will still collide if you only change visibility. Basically, the menu is still there, it’s just invisible, so it still collides. I dealt with this by simply changing its location when I change visibility. Move it somewhere out of the way, like directly over the player’s head, or beneath the player’s feet. Somewhere it can’t interfere with gameplay. This was a cheap and good enough solution for my needs.
The VR menu is acting as an overlay and should be considered running during other games, therefore I’m trying to minimize resources when it’s not shown.
I have since previous post fixed the rotation issue using my own solution here:
The Menu items / Actors are stored in memory and their visibility and location is set on a specific button click event.