GetWorldRotation returns wrong values with VR Template

Currently using 4.15 (master branch)

Create a new blue print project with the VR Template.

Open the MotionControllerPawn
In the eventgraph take the camera → GetWorldRotation → Print

Start the program in VR using an occulus rift.

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

The only way I could find to fix this was with an an if that when:

return value => 0, do value - 180 return

return value < 0, do value +180

Note this leads to allot of duplicate code, see example below.

It creates a menu overlay, when user clicks the menu button on toutch control.

The menu is shown where the user is looking.

Hello ,

I was unable to reproduce this issue on our end. I have a few questions for you that will help narrow down what issue it is that you are experiencing.

Quick questions:

  1. Can you reproduce this issue in a clean project?
  2. If so, could you provide any small steps that may have been over looked in your original post?
  3. Could you explain what method you are using exactly to determine that the rotation is not what it should be?
  4. Does this issue occur in the 4.15 binary version of the engine?

Hello ,

We have not heard back from you in a few days, so we are marking this post as Resolved for tracking purposes. If you are still experiencing the issue you reported, please respond to this message with additional information and we will follow up.

Thanks,

Hello Rudy,

This bug occured in engine 4.15. I have since the master branch (which is basically 4.16++):
https://github.com/EpicGames/UnrealEngine/tree/master

The -180 / + 180 fix is still used in order to render UMG items in the proper location in the world.

To reproduce you need an Oculus HMD. Then use Unreal Editor with the VR HMD Unreal Example combined with the following functions:

Use Init function to spawn an actor with an UMG widget with some image at the location you look at. If the -180 / 180 fix is not used the actor spawn at the wrong location. Bind Init to a button on your keyboard or oculus touch controller and then press it :wink:

After creating the blueprint above and testing this on our end. It appears to be working as intended. It sounds like the object that you are trying to rotate is not facing the camera. This is to be expected when setting the rotation to be the same as the camera. I have provided an example below. I hope that this information helps.

Example:

When setting the widget’s rotation to be the same as the camera, it is expected that the widget be facing away from the camera (because the widget will be facing the same direction as the camera)

Suggestion:

I would suggest using the “Find look at rotation node instead”. The example below is done from with in the widget menu (3d Widget) actor.

Make it a great day