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

[/LIST] 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?