How do I implement IsFalling() and GetVelocity() in a check?

Hello, I am currently trying to implement a dodgeroll function in my game. Right now, whenever my character dodgerolls, he rolls in place instead of not doing anything. He’ll also Dodgeroll in the air and I don’t want that. So, in code, how do I check the values of GetVelocity() and isFalling().
I want it to act something like this:

if(isDodgerolling != true || isFalling() != true || GetVelocity() > 0) 
{ 
Do stuff; 
}

Blueprint is a lot easier with this stuff but I don’t know how to say it in C++. Any help would be appreciated.

I’m assuming your character is extended from ACharacter, and it has a movement component.

Then you can simply do the following:

UCharacterMovementComponent* movementComp = GetCharacterMovement();
	
if (movementComp)
{
	const bool isInAir = (movementComp->MovementMode == EMovementMode::MOVE_Falling);
	const float currentVelocity = this->GetVelocity();
	
	if(!isInAir && currentVelocity > 0.0f && !isDodgeRolling)
	{
	    // Do a barrel roll
	}
}

Depending on exactly what you want, you can replace the “isInAir” part with checking whether the player is in any movement state other than falling (in the air):

const bool movementModeAllowsRoll = (movementComp->MovementMode != EMovementMode::MOVE_Falling);
const float currentVelocity = this->GetVelocity();

if(movementModeAllowsRoll && currentVelocity > 0.0f && !isDodgeRolling)
{
	// Do a barrel roll
}

Heyo, got it fixed, another user told me that I should’ve done was GetCharacterMovement->isFalling() == false && GetVelocity().Size() > 0. Unless you can tell me why my code might be a bad idea to use.

Ah yes - the other user is correct. Size() will give you the magnitude of the velocity vector. I typed too quickly without thinking.