VR Player/HMD Collision Detection

Hey All,

I was hoping someone could point me in the right direction or at least be willing to have a discussion regarding syncing and detecting the HMD with collision in game. Before anyone tells me to use the VR Expansion plugin, I am very aware of it but I want work on the code for this on my own for the fun of it.

The problem:
I have a somewhat working VR prototype at the moment that uses joystick locomotion/HMD tracking. Works as expected so far. The object hierarchy is like this:

  • Root

    • CapsuleCollider

    • VROrigin (SceneComponent)

      • Camera

        • MotionControllerL

        • MotionControllerR

This is basically what happens every tick:
Capsule Collider position = Camera./Camera.Y/CapusuleCollider.Z (this syncs the capsule collider with the HMD)
Then I add the X/Y values from the motion controller to VrOrigin and use the Z vector from the CapusleCollider to sync the height. Now gravity works and if I walk of a ledge I fall.

Essentially use the VrOrigin to offset X,Y world position and use the Capsule to set the world Z of the VrOrigin.

But where it falls apart is obviously I can walk through geometry in VR and the fact that the collider is well… colliding doesn’t matter. What I would like to happen is if there is a blocking collision like that the HMD/VrOrigin position gets synced and reset to the Colliders world location and it gets locked. Kind of like if “Reset Orientation and Position” was being called every frame. I cant for the life of me to get this to work.

Anyone have any ideas or thoughts to how they would solve this?

Thanks!

Hi,
I’m on the same boat, any luck finding a good resource for this?
Seems like a good tutorial for collision detection is missing for Unreal VR.

You can make the capsule the root and offset the VROrigin to place the HMD at 0,0 to the capsule, then when you move the actor (capsule) with sweep it will block and collide. To have the hmd movement added you just add the difference of the HMD from its last frame to current and add that to the actors movement (can sample this when moving the VROrigin to cancel it out).

If you wanted to keep your current architecture you would have to sweep the capsule when the actor moves.