Attach Character Collision Capsule to HMD (SteamVR)

sounds like you may need to take into account the rotation of the camera in one of the location samples, e.g. camera xy by rotating that vector by the camera rotation before setting it.

When do you call the sync function? Currently I’m calling from EventTick and it seems like when I turn my head, the camera is moving in the opposite direction. Same setup as shown above with Camera parented by a Scene.

I’ve unhidden the capsule so I can see it and it is following my camera, so that part works perfect. It’s just that when I turn my head to the right, I move just slightly to the right and when I turn my head left then I move a little to the left. I’m not moving my player, just turning my head. I’ll keep messing with it and update my original comment when/if I find a solution.

UPDATE/CORRECTION: When I move my head forward, like leaning forward, it is moving me backwards and vice versa.

I’ll look into the tick group thing, never heard of that before now.

This works for me as well :smiley: Thanks dude!!!

After doing this all myself and getting subpar results, I found 's VRExpansionPlugin which does proper multiplayer enabled collision out of the box. More info here: VR Expansion Plugin - XR Development - Epic Developer Community Forums

I honestly can’t recommend this enough, saved me a ton of time and effort.

I tried you function method and it seems to be working quite nicely.

One thing I can’t figure out yet is how to offset the location of the camera and capsule. I would like the capsule to be offset so that it is centered roughly under my feet (as opposed to the HMD origin). Can you recommend a simple approach to doing this?

I’ve tried plugging in add vector nodes in various parts of the function but it’s just pushes the capsule further away from the HMD on each tick. I tried adding a float to the relative location X of the camera but it just offsets it in world space, not relative to the position of the capsule.

Since the capsule is the root node in a character you cannot offset it with respect to actor origin, but you can move all the things attached to it. Consider adding a scene node where you parent everything else that you’re interested in. If that doesn’t work you may need to switch to a pawn which will allow you to customize the hierarchy fully.

Hi Did you manage to find any better solution to this problem ?

Regards!

YES! This plugin: https://bitbucket.org//vrexpansionplugin

Thanks for the answer.But is there any non- plugin solution for this, even not fully working?

The answer is because i am not C++ familiar.

If by non-plugin you mean built into the engine, then no.

But why don’t you want to use a plugin? It’s free and open source. And you are totally free to rip out the code for your own use. In my game I have pulled out and used the plugin code to create custom a custom VRCharacter class which extends the ShooterGameCharacter from shooter game sample. The most important piece of code is the VRMovementComponent, which basically does everything I mentioned above, very efficiently and multiplayer friendly.

I doubt you’ll be able to find a better solution anywhere else right now. Cannot recommend it enough.

Works great for position. I have orientation issues like Modeus Games. I’m turning the capsule with left thumbstick (cause I like games that let you do that otherwise I get tangled in the cable). position of the camera and capsule stay aligned however the more I turn the capsule, the more the orientation of the movement of the HMD and capsule misalign. I’ve tried many things but it always makes it worse.

I’m trying to add smooth locomotion and colision to the UVRF template. I’ll post it there when I fix this.

update with rotation fix: Sync Character Collision to HMD with Rotation Fix posted by anonymous | blueprintUE | PasteBin For Unreal Engine 4

Thanks for your solution, this works perfectly.
I’m letting the camera to be separated from the capsule in some scenarios but the problem is when I try to snap the camera back to the last location where both camera & capsule were aligned, it does not work… can you give some help please, all my three methods are failing?