I’m trying to implement a standard thumbstick movement into a Touch project but I’m having a few issues. I’ve been prototyping in the VR Template project and I’ve added a Character BP and copied over the logic from the MotionControllerPawn and added the following logic for movement:
In the VR Template - MotionControllerMap, the VRPawn is derived from Pawn, not from DefaultPawn, so it doesn’t have a Motion Component by default. Add Movement Input doesn’t work in this case, unless you implemented something in your Event Tick.
If you start from the VR Template, in the MotionControllerMap, add the following to the Event Graph of the Pawn to implement Thumbstick based movements (you can similarly add a rotation using the X axis of the Right Thumbstick).
To make the movement faster, you can multiply the output of the Motion Controller axis by a float > 1.0. To make the rate of movement independent from the FPS, you can multiply it by Get World Delta Seconds.
Marco’s solution gets movement working, but only in world space. I’m trying to add functionality to this so when I press forward on the thumbstick it moves forward relative to where the HMD is looking. Any help pointing me in the right direction (pun intended) would be most appreciated.
In the blueprint above, just use the forward vector of the VR Camera rather than the one from the root component of the pawn. That will move you along the direction you are looking at. This said, you will also need to implement a bit of rotation to also turn the “body” (aka the pawn root component) in the same direction otherwise you will soon get neck strain. Speaking out of experience.
Add the new controls to handle movement and rotation (see attachment). Movement is dependent from the HMD orientation (e.g. move the stick forward and you will be moving toward the direction you are looking at).
I am so grateful to you Marco. Fantastic explanation and worked perfectly! So amazing of you to go to such detail.
I think the issue I had was my AddWorldOffset nodes were targeting a Scene Component (the camera) and they were not AddActorWorldOffset nodes.
This funtionality is great, but of course it brings up so many other questions. I’m going to play around a bit and see if I can figure out how to limit the motion to the X/Y plane and not allow the player to float through the floor. Wish me luck.
This is exactly the reason why the Project Vector on to Plane nodes are being used. Even if you look up or down, they constrain the Delta Location vector to the XY plane so there is no vertical movement.
I wanted to say a big thanks for your tutorials, they are really really helpful.
I have used both of your locomotion thumb stick tutorials, combined them together ( probably breaking some fundamental rules and making a real dogs dinner). I can now move and look independently and climb stairs. I am experience some some issue with locomotion which is if I grab something ( with sweep turned on ) I then cant seem to move properly until I let go, Ideally I would like to be able to move around whilst holding objects and climb stairs.
let me jump in and revive once again this thread. it’s simple yet fantastic, I’ve been trying to add this for a while now and just managed to do so after finding this thread. kudos
so I was coding this and debugging sitting on my couch and I was like 2 or 3 meters away from the sensors, and noticed a weird behavior (feature I suppose), when rotating (using the add actor world rotation) I was rotating around an axis in my front, not around myself. that was because I was far from the sensors, and I suppose moving the hmd back only offsets it’s position from the VR origin, doesn’t actually move the pawn.
is there a way to make it rotate around itself instead of the origin? i tried setting the target to my camera but it didn’t do anything. here’s my code:
hey @vr_marco I’ve seen your videos and they are awesome, however I don’t think I ever found a mention of a similar issue as I mentioned above, perhaps people don’t usually get far from their sensors? do you have any idea how to prevent this?