Download

Why cant I change capsule component size relative to feet?!

For example, trying to get my character to slide under some stuff. The animation and slide all work great, but since the capsule component is static upright… it blocks the player from sliding under things since even though hes sliding the capsule component moves with him but stays vertical. If i disable collision on the capsule, he falls through the floor of course.

Changing the half height doesnt work right because it makes the capsule smaller but then part of the character’s body falls through the floor since the capsule is centered at his hips and not his feet.

I found a work around
I enable “can crouch” in the movement. Then use the built in “crouch” “uncrouch” functions.

They set the capsule to a smaller size relative to the feet.
Just seems like a silly thing to have to work around. I should be able to set the capsule size to whatever I want, relative to feet OR hips depending on what I’m doing. With this work around, I now have to make all level “sliding” interactions the same height as crouching ones to ensure the capsule makes it underneath. Despite the fact that when sliding, the player is much more horizontal then when crouched, so theoretically should be able to slide under things that crouch wouldn’t normally work for.

I think you can set component locations in actor and world coordinates too, so on crouching you can decrease halfheight and capsule relative location e.g.: new_capsule_z = original_capsule_z - original_capsule_halfheight + new_capsule_halfheight
or if you want to keep original capsule location, you can ray trace the surface on movement downwards from actor location, always keeping actorlocation.z over surface + capsule halfheight, thus actor location will move downwards properly when its size is changed.
of course a helper function could be included in the source, they would be only a few lines…

Well here is an option in the CharacterPawn->MovementComponent-> Crouch Maintains Base Location, but no idea how use since is disabled or something I miss.