CrouchRadius causes pawn to step on ledges

Because my pawn’s CrouchRadius is wider than it’s standard collision cylinder radius, whenever I crouch next to ledge (at around waist height) it causes my pawn to partially mount the ledge.

What I would want to happen is for the pawn be pushed back away from the ledge.

Unfortunately CrouchRadius is only used in native code (from what I can tell), so I can’t look to see what it’s doing.

Anyone have any idea of how to make is so the pawn will push away from the ledge when it’s collision cylinder radius is increased (or at least not mount the ledge)?

Cheers

It looks like CrouchRadius is used in Crouch and UnCrouch. Those functions check for encroachment with the new collision size, and if there’s no encroachment, they set bIsCrouched and bNetDirty (to replicate the crouch/uncrouch). Then they call the UnrealScript events StartCrouch or EndCrouch.

I think you’ll just have to fix it all yourself: Override StartCrouch for your pawn class, do some downward traces to see if you’re near a ledge, and if so then apply an acceleration away from the ledge.

Thanks for the response @Nathaniel3W

I don’t see it being used in those functions:



/**
 * Makes sure a Pawn is not crouching, telling it to stand if necessary.
 */
simulated function UnCrouch()
{
    if( bIsCrouched || bWantsToCrouch )
    {
        ShouldCrouch( false );
    }
}

/**
 * Controller is requesting that pawn crouches.
 * This is not guaranteed as it depends if crouching collision cylinder can fit when Pawn is located.
 *
 * @param    bCrouch        true if Pawn should crouch.
 */
function ShouldCrouch( bool bCrouch )
{
    bWantsToCrouch = bCrouch;
}


And Crouch() I only see as a cpp ref at the top of the Pawn class:



virtual void Crouch(INT bClientSimulation=0);


Am I missing something? Your suggested solution does sound decent however, I’m just not seeing what you’re seeing in the source.

Yeah, sorry. I should have specified that’s what it does in native code. I hope Epic doesn’t sue me or anything.