Setting HMD Orientation - Switching Pawns

Hello Devs,

I have been hitting my head against the wall for weeks now. I am working on a VR project which includes the ability to teleport. Switching from an exterior perspective of a vehicle to an interior one.

The problem I have been running into is all about the direction the player is looking, once their location is changed. No matter how I approach it, I cannot reliably set which direction the HMD will be facing in world space, once the player character is teleported. The player can teleport to inside the car’s interior at any point, which means they could be facing any direction when they press the teleport button. Because I cannot properly set the orientation, the player might be looking at the back of the seat, rather than the steering wheel.

I have approached this problem from dozens of angles but I am new to scripting VR so I have been relying on Blueprints. I was wondering if anyone has been able to set HMD orientation in world space with the use of blueprints.

Has anyone had any luck with teleportation?

-Vince

Simpanzee, I’ve been struggling with the same issue. I’ve also tried several different ways I’ve found in the answerhub to try and bypass this problem, but no luck yet. This problem happens on every kind of transition, in my case when changing levels.

Hopefully someone will know some way to help us, or maybe this might somehow be fixed on the upcoming 4.9 hotfix with 0.7 enhanced support.

p.s.: I think it’s useful to tell in my case I’m working on 4.8/4.9 with a Oculus DK2, sdk 0.6 (also tried on 0.7)

Glad to hear I’m not the only one! I’m currently working in 4.9 with various HMDs

It seems like what we need is a positional override which is independent of the controller. The main issue I run into - the camera, character, and player controller cannot receive extra input reliably, but there has to be some workaround. It is possible to change the camera’s orientation with the player controller. Move the mouse to the left or right and so does the camera. I guess the goal is to read the world rotation of the HMD camera, and then offset the controller to match a target direction. Although, the character blueprint is a little difficult to work with because the HMD has influence over many of its components.

The problem doesn’t seem specific to the HMD hardware. I’ve had these issues with Oculus DK2 and Crescent Bay 3. I received a Vive dev kit yesterday, so hopefully in a few days I’ll have a better idea if it is easier to control. I think its going to suffer the same issues. I have a feeling we have everything we need to get the job done already but I have run out of ideas. haha

-V

Get the player controller, and use SetControlRotation. That’s what I’m using to control player orientation on Vive, Rift, and Morpheus.

Here is how I was moving my player around to different spots on the map.

1 Like

I have the same issue! Trying to deal with it since UE 4.3 (I think). Nothing has worked so far! This is really a BIG issue Imo!
I used so many different approaches and hints from this forum, but nothing worked!

Thx@Pixelvspixel for your suggestion, I will try that and report back!

€: Where is your function “Teleport HMD” placed?
I use it in my Pawn BP. Maybe there are some other limitations we don’t know about?

Sorry for doublepost, but no luck here :frowning:

I use a simple Blueprint with a collision box, placed in the level:


It detects collision, then Calls the Function “Beam…” in my Character BP, with a targetpoint as a variable.

So, here’s the Function in my Char BP:


If the HMD is off (=> Standalone Preview) it works like a charm!
But as soon as the HMD is on, it doesn’t!

One thing I have noticed:

Directly after the teleport is executed, the view rotation seems to be right for about 1 frame!
I can see a glimpse of the right direction (for about 1 Frame). It seems, as if the “Set Control Rotation” Command is executed, but instantly after that the player is forced to look into the original rotation (from before the port)!

I really have no idea what to do! There is no other “set control rotation” command or anything else!

Plz help!

Thanks!
Cheers
:slight_smile:

€ Using 4.9.0

Made a new simple BP, but also doesn’t work:


I recorded a video, and as soon as the Setcontrol Rotation Command is executed, the view changes for 1 Frame, and is then set to the rotation, the player was watching before :confused:

I recorded the “SetControlRotation” Command and played it frame by frame via MPChc:

€2:

I just created a new Project from the 1st Person Template in 4.9.0.
Just added a BP, with the simple SetControlRotation Command (as in the last picture).
=> Same behaviour :frowning:

nn23,

I have also experienced the behavior of seeing the correct orientation, but for only one frame. Seems like the script is behaving properly but after the first frame the HMD orientation is reset to the previous offset. So it seems like the “Set Control Rotation” is frame specific, when we want it to be “fire and forget.” There must be some HMD logic which is not properly communicating with the blueprint functions.

Very strange. Is there anyone out there who knows a traditional C++ way around this?

-Vince

Hi,

I opened a Bug Report on AnswerHub.
If you are affected by the problem please go there and make a comment!

I played a little bit with the “Char BR” -> “Camera Manager” -> “HMD Follow Orientation”

If this is set to True, I can yaw without affecting the orientation of the character (decoupled head/body movement).
If I use the SetControlRotation Command there, it works at first, the Player and the camera switch to the supposed new angle.

=> But as soon as I set “HMD Follow Orientation” back to False, the Camera snaps back to the “old/wrong” angle.

This is how I solved a very similar problem each time the player presses the assigned button the camera resets the view so that the view is centred on the player character.
516063ce39c16b7c7b7bd7f9339076185b654e36.jpeg

For your case I guess you can just plug in the vehicle yaw value (and select the appropriate enum to reset both rotation and position or just one of them). The most important node is Reset Orientation and Position.

Oh cool, this looks like an excellent solution! I’ve never used a “Find Look at Rotation” function before. I’ll give it a shot!

A little clarification and an update:

The issue of setting the HMD direction stems from using the default 1st person character controller. I like using this setup because the controller automatically is oriented to the camera view (the character moves in the direction you are looking.) The relationship between the camera’s influence on the controller as well as adding extra input to the controller (via mouse) is super difficult to construct logically. Logic which interprets the relative orientation of all of those components is a bit outside of my personal skill set.

Here is the good news! The comments from** combatdave** and** pixelvspixel **are extremely helpful and do solve the issue, but it requires the camera to be independent of the controller. Telsa has a concise tutorial on how to enable independent control: Tesla Tutorial

With this approach a few things have to change in the player blueprint but it does seem to be a better approach for a first person character. I’m sure it’s possible to regain the lost function of the character controller following the camera orientation. I would recommend any other VR developers working on first person experiences to use this approach for now.

I’m sure there will be plenty of new obstacles with this new approach, but at least it solves a longstanding and frustrating one!

-Vince

That would explain it. The Blueprint I shared with you, was using a modified version of the VR Template you find here in the forum and not the basic First Person template you can choose to start with.

Glad your getting closer.

Awesome! That helped me a lot! Thank You!!!

Seems to work

I can confirm that after teleporting the player pawn, using the “reset orientation and position” node allowed me to adjust which way I wanted the player to be facing post teleport. (using Unreal 4.15.1)
I’m attaching my BP for reference, but I should note that my player pawn is from scratch, but its just a camera with a capsule collision and the HDM check activated.

In the BP I’m casting to the player to fade the scene in and out so the teleport isn’t super jarring. I use the rest node to change the yaw before I fade back in. There’s the potential that the player will be facing the new direction with their head positioned toward whatever they were last looking at but that’s another issue entirely.

Hope this helps anyone struggling with this.