Dynamically Resize Capsule

I am trying to allow my VR character to duck, reducing the size of the capsule as I lower the HMD. The capsule is resizing, but as it does my VR floor plane appears to rise up.

In this short video, I’ve placed my left controller on the floor and then bend my knees to crouch. You can see how the floor comes up, obscuring the controller, which remains stationary on the floor. If I continue to crouch further, the floor continues to rise and I can, if I get low enough, get my camera under the floor.
Sinking Controller. And I’ve made a drawing of what I believe is happening: Drawing

My capsule resize code is very simple and currently hooked up to OnTick. Once I get this working, I can optimize that. Resize Capsule This code also ensures that the capsule follows the HMD as it moves around in room-scale.

I’ve modified the BP_MotionControllerPawn from the VR Template to extend Character rather than Pawn, so my hierarchy looks like this: VRCharacter

My capsule half-height is 88 and the VR Origin sits at -88 Capsule

I’ve been trying to solve this for a week now and am completely out of ideas. I’ve tried adding an offset to the VR Origin, but that causes me to fly upwards. I’ve tried using the Camera rather than the HMD location.

How can I fix this?

1 Like

Hello. I don’t have the skills to help you but I still want to share my experiences. I am facing a similar problem. I write about it (confusedly) here: Full IK Body in VR with Unreal Engine 5.0.3 . Basically I’m trying to use a full body avatar and implement the IK Rig so that my avatar’s legs fold when I crouch. In my opinion the problem I find is similar to yours and is related to the different sizes between VR camera, Character, etc … In my rig the control rigs of the feet remain at ground level while the bones of the feet obviously follows the skeleton. From the way the skeleton deforms I understand that my character is extremely high above ground level. I believe that the solution consists in resizing my avatar according to the coordinates of my HMD, that is: floor height of the HMD; distance between controllers. These parameters should be transferred to my Rig. In my opinion there are many problems due to the early adoption of the OpenXR runtime. The problem for someone who has just started using Unreal, like me, is that I don’t notice when I’m wrong and when the engine has bugs. I’ve been banging my head on this particular problem for at least ten days. Good luck! I wish there were more resources dedicated to VR. It is all extremely confusing. Unfortunately, we are still in its infancy, despite half a dozen years having passed since VR began to spread.

Hi all,

Incase anyone comes across this later, I think this community tutorial will help anyone fuse the character movement component with VR (including a dynamic collision capsule that allows you to duck + move through low areas)

Full body IK is a different can of worms!

Cheers

I did eventually solve this, with a lot of help from @vr_marco. Since then, Jonathan aka @GDXRStudio created a tutorial based on my work and that video is here. Jonathan has since gone on to create a VR Template for 5.x that supports all kinds of things. You can see what he’s working on here and it should be available in the Marketplace soon.

3 Likes