Change the minimum 'Falling' movement mode height

Just a quick question, hopefully there’s a simple answer: How do I set a minimum height for the ‘Falling’ movement mode for my third-person character blueprint?

My player character is walking down a staircase and I don’t want the ‘Falling’ movement mode to be triggered if some of the steps are slightly too tall. If there’s a minimum threshold before the movement mode switches from ‘Walking’ to ‘Falling’ I’d like to be able to increase it by a small amount.

I’ve looked at the Class Defaults but couldn’t find anything relevant. Max Step Height only affects going up the stairs.

Thanks.

My suggestion was going to be the Max Step Height. Other than this I don’t really know, however my knowledge regarding animation and characters are slightly limited due to experience. You could setup a check to verify that the character has to fall for X amount before the animation triggers.

Hopefully someone with more experience can chime in on the subject.

Sure, I can set up a timer to check that and manually change the movement mode from falling back to walking, but that’s something I shouldn’t need to have to do.

For now I’ve been able to work around the issue by simplifying the collision on my staircases. Basically just turned them into ramps. Foot IK looks ok going up the stairs, but going down it looks like there’s some goose-stepping going on.

Hey @Knuthnads

Are you using the default Third Person Character?

Not sure if it helps, but the ThirdPersonCharacter supplied with Unreal 5.1 has a Character Movement Component.

While I don’t see the value you need exposed to the editor, if you search the c++ .h file you find this,

/**
* Whether Character should go into falling mode when walking and changing position, based on an old and new floor result (both of which are considered walkable).
* Default implementation always returns false.
* @return true if Character should start falling
*/
virtual bool ShouldCatchAir(const FFindFloorResult& OldFloor, const FFindFloorResult& NewFloor);

Which seems there is code in there that checks the floor difference. Finding how this is set and maybe exposing it to the editor might help?

I’m not versed enough in c++ to try im afraid, but maybe someone else is?

Stewart

Neither am I.

In CharacterMovementComponent.cpp I can see the following:

  	// Validate the floor check
  	if (CurrentFloor.IsWalkableFloor())
  	{
  		if (ShouldCatchAir(OldFloor, CurrentFloor))
  		{
  			HandleWalkingOffLedge(OldFloor.HitResult.ImpactNormal, OldFloor.HitResult.Normal, OldLocation, timeTick);
  			if (IsMovingOnGround())
  			{
  				// If still walking, then fall. If not, assume the user set a different mode they want to keep.
  				StartFalling(Iterations, remainingTime, timeTick, Delta, OldLocation);
  			}
  			return;
  		}

  		AdjustFloorHeight();
  		SetBase(CurrentFloor.HitResult.Component.Get(), CurrentFloor.HitResult.BoneName);
  	}

I’m assuming if I comment out the ‘if (ShouldCatchAir(OldFloor, CurrentFloor))’ block I should just be able to set the falling movement mode manually based on a path trace?

Unfortunately I’m having trouble creating a new C++ class. I’m not a programmer and have no idea what I’m doing wrong here. Went to Tools > New C++ Class and created a new empty C++ class.

Project now includes sources, please close the editor and build from your IDE.

Successfully added class ‘MyCharacterMovementComponent’, however you must recompile the ‘TestProject’ module before it will appear in the Content Browser. Would you like to edit the code now?

Chose ‘Yes’.

I can see a whole slew of errors already with the default code in Visual Studio. 'Cannot open source file ‘CoreMinimal.h’, ‘name followed by ‘::’ must be a class or namespace name’, ‘incomplete type not allowed’, and so on. Tried compiling before changing anything, build failed with:

The command ““D:\Program Files\Epic Games\UE_5.1\Engine\Build\BatchFiles\Build.bat” TestProjectEditor Win64 Development -Project=“E:\Projects\Game Development\TestProject\TestProject.uproject” -WaitMutex -FromMsBuild” exited with code 6.

Restarted the Unreal Editor.

The following modules are missing or built with a different engine version: TestProject. Would you like to rebuild them now?

Chose ‘Yes’.

TestProject could not be compiled. Try rebuilding from source manually

Can no longer open my project.

i dabble in c++ but not versed enough to go to far like this. Ensure you have the unreal plugin or extensions (not sure what they are called) for your ide.

You might need to ask a new question about the compilation errors to get more response from those that understand it better sorry.