Download

[TUTORIAL] Using thumbstick locomotion with the standard VR template

Hi there!

This seems to be a recurring topic/request among those starting to build VR experiences with UE4, so I thought it would be useful to make a short step-by-step tutorial covering it.

https://youtube.com/watch?v=kGCS4rJYzoM

The tutorial includes two: 1. Direction of locomotion following the HMD orientation, 2. Direction of locomotion independent from the HMD orientation.

Both variations have a rotation option (left thumbstick) and the movement is constrained to an horizontal plane so there is no risk to go through the floor or fly off. There is also a collision capsule added to the pawn to prevent it going through walls and other objects.

NOTE: To keep it simple, this implementation is for a seated/in-place experience. Rotations will be inaccurate if you use it for a room-scale experience and start moving around IRL. This can be fixed implementing a roto-translation of the VR origin so the camera parented to it pivots around its vertical axis as expected. I may cover this in a future tutorial if anyone is interested.

Enjoy!

Cheers,
Marco.

i’m using this implementation a bit differently but i was wondering how one would go about changing the walk speed based on this tutorial you have presented.

EDIT: Problem solved…scale vector by int “Movement Speed”

Good you solved it yourself. Actually it would be better to use a float for that purpose.

And if you want to make the entity of the movement independent from the frame rate, you also need to multiply by World Delta Seconds. You can use Get World Delta Seconds for that:

Thanks Marco, the tutorial is really helpful!

I followed another ArchViz tutorial you made similar like this one. My question is how I can get the thumbstick control following HMD? Seems like it worked in your tutorial. But I watched and did 5 times exactly following your tutorial, the thumbstick control could not follow HMD, when pushing forward, it moves sideways.

Thanks,

@shineoooo If you take the Forward Vector and the Right Vector of the Camera (HMD) instead that the one from the Character, that should move the character in the direction you are looking with your HMD. I am showing this setup in the first tutorial but not in the ArchViz one. Anyway that part works exactly in the same way.

Thanks so much Marco! Not sure why I could not upload the image I wanted to show you. Anyway, I replaced them with Forward Vector and Right Vector. Everything works fine now but, only one issue, the camera height seems not correct. It is way higher than the VR teleportation one. I put two 1 meter boxes there as reference, it was like 2 meters high. I tried to switch to Eye level, then it turned out too low. Any suggestions?

Thanks again!

@shineoooo I had someone else having a similar problem and it turned out they hadn’t setup the VR Character correctly. It is easy to overlook in the tutorial, but the VR Camera is parented to the VR Origin and the VR Origin is dragged to the bottom of the capsule. The VR Camera is in Location 0,0,0 relative to the VR Origin. If you drag the VR Camera, instead of the VR Origin, to the bottom of the capsule, you end up being much taller than expected. This is probably your issue so you want to double check that.

Don’t switch to eye level. That won’t solve the issue. Floor level is the right choice for ArchViz.

Thank you so much Marco! Problem solved. I think I moved VR Camera pivot mistakenly to the bottom of capsule instead of VR Origin pivot. Everything works now. Really appreciate for your help and thank you so much for your patience with newbie! You made my day!

Can you show how to make the speed with this method?

Like this. Raise SpeedOfMovement until you are happy with how fast you move. Setting it to 180 is already doubling the original speed.

Thank you :slight_smile:

I use The Input Facebuttons this have not Axis Value.

Then you simply have only two values into the multiplication node, SpeedOfMovement and GetWorldDeltaSeconds. The rest is the same. The Facebutton input is triggered only when the button is pressed and that would be like having an Axis input with value 1.0

I Want make Teleport and this Method its work if not disconect Teleport Function but ist very bugy you have a idea to make this better?

Its all work perfekt without the Colision Capule, with standard DefaultSceneRoot work Teleport and Slide Loco but have no colision for walls etc

And i cant upstairs

What do you mean with buggy? What happens exactly? Did you remap the inputs as well?

Regarding walking upstairs, please check my ArchviZ locomotion tutorial. That may help you.

Ok i check the ArchviZ locomotion tutorial

With the buggy i mean i trry teleport and sometimes it works sometimes i stop at once the same place

but i test the ArchviZ locomotion and try it and if i have problems i write here!

Thank you for helping me :slight_smile:

One idea could be to add a boolean variable which controls whether you are using teleportation or thumbstick locomotion. You can toggle it with one of the facebuttons. Depending on its state, you can enable the teleportation part of the code or the thumbstick part of the code. With that you would limit the interaction between the two modes.

I Think this is not the Problem the problem is the Capsule Colision but i try first the other Tutorial from you.

I have solved the problems

Last Problem is that the capsule does not move with the camera if you make The Capsule Visible in Game you see if you make real steps the capsule dont move.

You mean if you move in real life in a room scale setup? Then no, the capsule will not move because it is the root component and the Camera is lower in the hierarchy and locked to the HMD. If you want this to work with room-scale movements you should look into plugins like Mordentral’s one. Or take a completely different approach where your collision checking volume is handled separately from the camera and kept aligned with it at each Tick.

Yes

How? can you make a Tutorial for this?