Rotate the player based on HMD viewing angle from location.

I set up a nicely working system that will rotate the player when they turn their HMD past a specified angle. It’s almost perfect, but I’m having an issue rotating around the HMDs location. It seems to be rotating around on the Origin point, not the exact center of the HMD. I have played around for hours trying to set this up. I think I’ve got the vectors wrong, or for some reason I’m just unable to get the HMD’s exact location when I try to use the “Get Orientation and Position” function.

Anyways, instead of showing the giant mess of wrong blueprints and vectors all over the place trying to get this to work, I’ll show you what I have that works.

I need to rotate the player just like this, but on the HMDs position. Right now if I walk to the edge of my play area and try to rotate, I feel like I’m being swung from the center. Instead of just rotating where I’m standing.

So basically, I need to capture the HMD’S location anywhere in my real world play space. Then when I’m trying to rotate like you see in the picture, it needs to rotate from that specific location in the Z axis. Right now it’s rotating, but not at the right location.


Still trying like hell to figure this out. I’ve come closer, but I still can’t get a working solution to this.

Actor != HMD.

Your Actor Location is the middle of your Bounds. So the middle of your room or where ever you set this up.
The HMD location is your Camera.

You are currently rotating the Actor, means it rotates around the middle of your room.
That might also end up rotating your HMD (happy puking)

My Components are ordered like this:

And I set the Location of the Middle of my Character like this:

“SwordHold” is a on the left side of my hip and I want the height to be 50 units below my HMD.
A bit hard coded at the moment, but it works.

You already have a rotating algorithm, so don’t get confused by mine, but I simply get the
ForwardVector of my HMD horizontally aligned to the ground. That’s why I removed Pitch and Roll.
And then making a dot product with the current ForwardVector of my actual Character Mid.

If they are more than 40 degree apart, I do this:

So the “CharacterMid” is simply a substitute for the actual mid of me. It gets forced to be below my feed
by simply setting the X and Y to my HMD/Camera Location.

WOW! Thanks for taking the time to lay this out like this. It’s a great help! More then you know.

First off, I just want to have this be an option for the player to use. A lot of users claim that they don’t get motion sickness like most of us, so I just want to let them be able to decide between some controls. :slight_smile: However, using the rotation method I setup is actually quite comfortable, and I know it would be a lot better if I could get this to rotate right. So at least we know why I’m trying to set this up.

I have been trying this out, but I haven’t had any luck. I broke this down the best I could understand it.

1: The first thing you’re doing is setting the position of your holster and mid to your camera. Since I didn’t need to do that I skipped over it. I’m just trying to rotate the VROrigin on the Z at the cameras XY location. Although I tried to SetRelativeLocation of the VROrigin to the camera, but that was instant motion sickness, and it STILL didn’t rotate at my feet… :S Not sure why. So this got skipped. As I figured I didn’t need it, and it didn’t work out for me.

2: I see you’re basically just getting the degrees of the two vectors here from each other, so I didn’t use this either since I don’t actually need to do this for what I’m trying to achieve.

3: I actually don’t need this either, because I’ll be rotating my player in increments to prevent motion sickness, and I have a scale Delta plugged into a float for smoothness if I needed it. HOWEVER… :slight_smile: I did discover you’re rotating relatively, and I was adding local. So I did learn a little bit on that. tips hat

But I’m unfortunately still unable to figure this out, and I’m starting to think it may be a bug? Perhaps an issue with the camera maybe? When I look down and rotate, it should be rotating at my feet. If I AddRelativeRotation to the Camera, nothing happens. If I AddRelativeRotation to the VROrigin, it rotates, but not at the camera’s location. Sigh. I think yours works well because you’re setting locations to the camera and rotating them, but when you try to actually rotate the camera, it doesn’t work, nothing happens.


Ah, sorry there, I thought you want to rotate the something to match the Camera.

I didn’t know you are trying to rotate the camera/HMD itself. That’s nothing I would really recommend, but I guess
you need that :stuck_out_tongue:

I think you can’t set the Relative Rotation of the Camera, as the Camera follows the HMD.

I found out that you can call “Reset Orientation and Location”, which will set the YAW value.

This means, it simply sets the Relative Rotation YAW of the HMD to the YAW value you put into.

I haven’t checked how to properly rotate the camera with this, but this is basically the thing to FORCE rotate the HMD.

Following Blueprint Code moves the head constantly 20 unity a second around the YAW Axis, while also taking into account that
the Player Moves his head at the same time. So it only adds on the current YAW.

Here’s the problem with Reset Orientation and Position.

I was actually able to create a semi working solution to it. HOWEVER… Under the “Options” you have either Orientation, Position, or Orientation and Position. The “Best” solution is to use Orientation and Position here. If you only use Orientation it starts back at the beginning of this topic. haha. It will actually rotate around the first “Initial Position” of the HMD when you start the game. So im back to being “Swung” around a pivot.

If I use Orientation and Position, I was able to create a rotator from it with a Rinterp to constant and about 15 other nodes, lol… But I got it to work kind of. . It’s actually surprisingly comfortable in VR to rotate the camera with your head. As long as you can do it on your own feet so to speak. I didn’t get motion sickness at all. I might be on to something here. . . :slight_smile:

But here’s the problem… When I set this up, I noticed the only way I could get the camera to rotate on dead center, was if I used Orientation and position. However, this caused a “RESET” back to the original position of the HMD. So If I walk to the edge of my playspace, and I turn, it will teleport me back to the original position. Which I cannot have… But at least I rotate how I’d like to! haha.

I made art just so we’re clear on exactly what I’m trying to do. haha. Hopefully you guys enjoy this just as much as I do.

This is what the camera does currently. If I’m at the center of my play area it works fine.

If I move in my play area, and rotate the camera, I’m getting the same rotation point as when I’m at the start.

And of course, this is what I want to do.

Surely, there has to be a way. Right?

Hm, okay, I only tested it while sitting in the same place at the edge of my bounds.

Could totally be that you need C++ for this at this point, as I don’t know how to access the rotation of the HMD

Going on a week now lol. I have tried everything I know of!

If I Check ] Use Pawn Control Rotation in the Camera, and I use f “Add Controller Yaw Input” It will rotate right where I’m standing like I’m trying to get at, but the root of the player is walking around. Causing way more motion sickness.

Best way I can explain it is this…IN VR if you are playing from the original VR template when you walk around you’re player is moving around in the world. In any other (non VR) game, it’s like the player stands still, and when you move the world is moving around you. :S If that makes sense. When you look at the ground in the original VR template and you walk around in your play area, nothing moves except you.

When I Check ] Use Pawn Control Rotation in the Camera, and I use f “Add Controller Yaw Input” the entire world moves. And that makes you really sick, because you don’t get the sense of moving.

So I’m back to nothing. I think at this point, I’m going to agree with you eXi. As simple as what I’m trying to do is, I don’t think it’s possible in Blueprints…

All I really need to do is “AddRelativeRotation” (On the Z Axis) to the HMD where the player is located in their play area… lol. But I just don’t see how I can accomplish this.

There’s other vr games I’ve played where you can take the joystick, and rotate the player. It’s usually by a preset number of degrees, but you can still rotate. I can’t believe you can’t accomplish this in ue4 bps. There’s got to be a simple way I’m just overlooking.

Let’s say I teleport to a location, and want to rotate the player by any number of degrees from where he’s standing. I can figure out all kinds of way to make him rotate, but I can’t figure out a single way to make him rotate where he’s standing. . I’m going bald trying this. Someone is probably laughing at me right now waiting til I pull all of my hair out to tell me I’m just missing a single node somewhere. . lol

Edit: I gave up.

Going to bump this, maybe somebody might have a solution?

Hey folks, even tho this thread is quite old and you might have found a solution already, I just wanted to share my 2 cents aswell, since I ran into the exact same issue over and over again, including today.

I somehow managed to fix the problem, but the approach feels incredibly hacky and not optimal, however, it works.

Basically, the math we need is an actor rotation formula around an arbitrary point. Searching for this gave me nothing but headache so far, so what I’m doing is, i abuse the “Pivot Translation” feature of the RotatingMovementComponent.
A quick example setup would be (notice I used this in tick for testing, which I don’t want to recommend here, but you get the idea)

This will rotate your actor around the position of your camera, which in fact looks like you would rotate the camera itself.
As i already said, this is not ideal and feels weird to use, but I was very short on time. I/You should consider looking into RotatingMovementComponents Source code to pick the lines we need for this offset rotation and tinker a custom blueprint node instead, which I will do tomorrow aswell :wink:

Nevertheless, I hope this approach can help others, which face the same issue and give them hints to solve their problem :slight_smile:


Have you figured it out yet? I really need help with this, I’ve been looking everywhere and tried everything, but nothing works properly. Please help!

Well, quite an old post but here is the solution for this.

For C++ There is a function inside RotatingMovementComponent that let you rotate actors on a different pivot point but since there is no Quaternion inside the blueprints solution is I came up with is adding a rotating movement component to the pawn and give it to camera’s location as its pivot.
I know it is not a proper solution but it is working just fine.

With this, you can rotate your HMD locked camera in place. As I said not a proper solution for blueprints but working just fine

anyone test VRhmd rotation? look like recroom game rotation?…-keyboard.html

For anyone else stumbling across this thread. Here’s a very good tutorial on how to solve this: