[SOLVED] Comfort Turning in VR?

Hey guys! I’m pretty new to developing for UE4, let alone VR. I’m working on a title that utilizes locomotive movement opposed to teleportation. I’ve been dishing around and cannot find any sort of reference that could help me with a comfort turning mechanism for my project. What I’m asking for is something that will allow players to sort of rotate 45 degrees in the direction they move their joystick. This is specifically for Oculus and I’ve been having issues with pulling it together successfully.

I understand it’s probably a simple thing to do , but I’m still wrapping my head around blueprints and therefor failing to find settings that could help with this. If anyone can provide a simple blueprint explanation to this then I’d be gladly thankful!

EDIT: Another issue I’m having is being able to successfully remove the teleportation mechanic from the VR project template, I keep getting infinite loop errors. Can anyone help me out with this as well?

Did you start off from the standard VR template? Can you show your modified MotionControllerPawn Blueprint including the movements you have implemented so far? This will make it easier to help you.

There are also plenty of YouTube tutorials for you to follow and learn from. For example this one could apply (at least partially) to your case: https://www.youtube.com/watch?v=p4s-44PqQFU

Player Pawn blueprint. VRCamera is player’s camera component, VRRoot is root component. Yaw degrees input parameter is +/-45.

Yeah I started with the default and still at just that. Any part of it that I try to remove (specifically the parts for teleportation) and couldn’t figure out how to alter it without causing issues. So I’m stuck at the default.

Thank you! I’m going to try this out when I’m home and I’ll report back my results. Thanks again.

I’m making a similar thing by the sounds of it and I started off using the first person template, it still has VR support built into the blueprint but without the teleportation I think.

Reporting back, I still have issues and stuck similarly to where I was before.

@vr_marco The issue I’m having right now is I’m having strong difficulties with editing the VR template (trying to remove the teleportation mechanics) without running into infinite loop errors. This has led me to try using the first person template but I realized it’s a whole different ballpark with setting up VR that way… With that being said though, I’m still in the process of trying to figure out how I can achieve what I’m looking for.

@YuriNK What I’m running into issues with with your blueprint is that I’m not finding any input plug to make it work. I can set it up, but the issue is I don’t know how to set up input controls and cannot get it to work.

I’m still extremely new to blueprints and this is proving to be more difficult than I originally thought haha. Sorry for my ignorance, but I’m slowly wrapping my head around it.

My post #8 here is a step by step tutorial on how to add thumbstick based locomotion to the standard VR template. Have a look at the whole thread and see if you spot the issue in your implementation.

https://forums.unrealengine.com/deve…th-touch-issue

I’m running into the same issue as before, even after following your tutorial. It may be because of the new version of Unreal, but I’m getting an issue when I disconnect the teleportation functions, and it basically runs down a list of saying there’s an infinite loop with practically every controller input in the blueprint. I tagged an example, this infinite loop issue has been a brickwall for me when it comes to replacing the teleport functions, and it’s very frustrating.

I commend you for the help so far though, I really appreciate it.

This should work as expected also in 4.18.x. Just to make sure, you are starting with a brand new project based on the standard VR template, right? And that project runs property out of the box, without any error? The problem occurs only after you modify the Blueprint?

It must’ve been something I happened to do wrong on multiple occasions. Decided to try a new template from scratch (again) and it worked this time, no clue what I did to make it not work last time but it does work this time. Thank you very much for your help.

The issue I have now is any direction I look will send me moving in that direction, I saw your comment about how it should already be locked to the X/Y plane but in this case it’s not working. Is there also a way to work with collisions so the player can’t move through walls and other objects?

Sorry if I sound needy, I’m extremely grateful for your help.

This is feature, not an issue. :wink: This implementation provides a movement which follows the HMD orientation, but constraints it on the XY plane (horizontal plane) so you don’t find yourself flying into the sky or through the floor. This was the request by the OP of that thread.

If you want your movement** not** to follow the HMD orientation but rather follow the orientation of your virtual “body”, just replace the two nodes Camera –> Get Forward Vector and Camera –> Get Right Vector with Get Actor Forward Vector and Get Actor Right Vector respectively. In this way you are removing the dependency on the orientation of the HMD. See image below.

Regarding going through walls etc., the original pawn in the VR template does not have any collision component around it because it relies on the navigation mesh to stay within the room and away from the walls. To solve this, do the following:

  • Add a collision capsule to the pawn
  • Make the capsule the new root component of the pawn (just drag and drop it on the root to replace it)
  • Set the capsule collisions to BlockAllDynamics
  • Move the VROrigin down until it is flush with the bottom of the capsule
  • Tick the Sweep option within the AddActorWorldOffset nodes used for the thumbstick navigation
  • In the level, reposition the VR Pawn so it sits properly in the floor otherwise you may be stuck into it


And in case you still need it, I just released a YouTube tutorial covering this topic. You can find it here:

https://forums.unrealengine.com/development-discussion/vr-ar-development/1408924-tutorial-using-thumbstick-locomotion-with-the-standard-vr-template

Thank you very much marco, your help was insanely useful and allows me to continue with my project. I’m extremely grateful for your help.