VR Camera rotation around itself

Hi,
I am looking for a solution to my problem with relative rotation. I am trying to reproduce camera rotation as in Pavlov VR where you use your thumbstick X axis to rotate around. I tried to add relative rotation to the camera in my pawn, but that did nothing. I think it is caused HMD rewriting location and rotation every frame. So I didn’t hesitate and try to rotate VR origin. And this worked. But after I make a few steps and get out of the center of the room I found out that the camera wasn’t rotating but only the origin rotate which create this weird drifting movement which causes a bit headache. I will add an image so you can understand it better.

The green arrow indicates the facing of the player.

Is there some solution to this situation or I will have to live with it.

I would be glad for any help.

try rotating the entire pawn/ character rather than the camera

I have tried that but as I said this result in a rotation around the center point of the room.

Anyway, I found a way to achieve my desires. I make some algebra with rotation a location of the entire pawn, which results in complicated code (for such an easy thing to be done), but it works.

Now I am just curious if there is an easier way.

You may have come to the same solution, but here’s how I would do it. First I’d find the red arrow pointing back towards the center of the room by subtracting VR Origin location from Camera location. Then I would rotate that around the up axis [0,0,1] by whatever blue angle you want to determine the new dotted red arrow. If you add that back onto the player location, you’ll have the new location of the VR Origin. Then it seems likely that whatever blue angle you rotated by will need to be applied to the VR Origin too using a relative yaw.

You are right that is exactly what I did. But your code is much cleaner. Thanks

I’ve been toying with a bunch of ways of doing this for a sim I’m working on, but so far, this is the easiest and most straight-forward way of rotating an actor around a pivot. You might be able to substitute the VR origin with the actual pawn, but because this works, I see no need.

I’m only replying to let others know that the input coming out of the custom event should be the action value for their IA responsible for turning. I went as far to simply replace the custom event with said IA and added a turn speed multiplier before connecting it to the rotation nodes. This solution works very well for UE5 VR projects and will singlehandedly save my game development since it was impossible to get my UI to face the player straight on beforehand. Thank you!!!