Resize the Capsule in VR

Following the advice of the Unreal Engine C++ course, I am trying to experiment along in my own “passion project” but I’ve run in to a problem that is beyond me. I’m trying to resize the capsule so that I can duck and crouch. My code is sort of working, but not correctly and I’m wondering if this is related to the VR Root that @sampattuzzi covers, but on the Z axis. I’ve tried to provide an offset to account for the difference in height between the apex of the capsule vs the eye-level height of the HMD. It’s helped a little, but not much.

One change I’ve done to make this work better with Blueprint is that I moved the VR Origin from mid-capsule to the bottom (-88 on the Z axis).

The issue that I’m having is that the capsule is sizing at a different rate than my HMD movement? I’m not exactly sure. But as I crouch down, the floor plane comes up to meet me. It’s as if the capsule is resizing at 2x the rate I’m lowering the HMD.

I’m prototyping in blueprint, just because it’s faster to turn around builds. Eventually this will be in C++.

It doesn’t seem like you are adjusting the height of the capsule. Unreal won’t let the capsule penetrate the floor. So this probably isn’t working as you’d expect for that reason.

Hi Sam! Are you sure that you saw the entire blueprint? There are three comment blocks. The first block “Handle Roomscale” is from your course. The second block draws the capsule. The third block in the execution chain is where the capsule is resized with SetCapsuleHalfHeight.

Sorry, I saw the rest now. I don’t know what units are returned from “Get Orientation And Position”. Why not use the z offset you ignore from the top line?