Smooth crouch using OnStartCrouch

Been trying to figure this out but nothing i do to the camera or the base crouch eye height will do anything when i try to modify them. and i have also tried setting the crouch base eye height to the same position as the eye height.but nothing i do changes anything on the onstartcrouch override. tried to do interptos as well. anyone got any kind of information on this. im trying to stay away from extra code where u have to reinvent the wheel when one is already implemented. specially since i dont want to create more performance overhead with extra object overhead checks since the controller already does this.

Eye height is changed internally. It will toggle between the default BaseEyeHeight and CrouchedEyeHeight, triggering the OnStartCrouch and OnEndCrouch events. Are you trying to get only your mesh to smoothly crouch or the capsule as well?

Just the camera. since the camera is legit just moving instantly to the crouch eye height. but even if i interp the camera position it gets ignored as well when doing crouch i figured over riding the onstartcrouch i could at least use that to interp the camera to smoothly move into position it needs to be. and vice versa with the override on the onendcrouch. or should i be adding my own camera and just disable the one that is inherited in the character so it wont auto move the camera. because i noticed anything that is not inherited from the character.h. such as i have a separate skeleton for my third body which allows me to modify its position in the onstart /onend crouch functions. i just figured id ask before having to resort to this method.

What is the camera attached to?

to the capsule component normal hierarchy for a basic character when u create a character script.

I’ve done many sermons warning against the temptations of using the default UE4 (and UE3) crouch implementations. It is unfortunate but with crouching we’re not reinventing the wheel, it’s going from flogging a disabled horse to using a car. Link for a simple implementation.

True. I wish they didn’t force us to use the capsule center as the character origin. When the origin is at the base then crouching (and other stuff) is 10x easier.

The easiest way to get the camera to “crouch” would be to attach it to the head bone (or a socket attached to the head bone) of the skeletal mesh. You will get head bob but it is very easy and some people like head bob. I have a 3rd person setup and putting the SpringArm on the mesh (plus camera lag) works out very nicely. Not sure about 1st person.

Select the CameraBoom, Enable CameraLag. You can play with the Lag Speed to make the camera feel heavier, which imho is more realistic.

320775-cameraboomcameralag.png

5 Likes

I know that’s a late response but this works perfectly fine and is defintely the easiest option rn ! Thank you!