How would I use CharacterMovement->IsInWater?

I’m having some trouble understanding how to use CharacterMovement->IsInWater. I’m trying to use it to swim upwards when jumping if I’m inside a physics volume marked as water, but the compiler complains when I use it like this:

void AMyCharacter::OnStartJump()
{
	if (CharacterMovement->IsInWater == true) //if the player is in water...
	{
		const FRotator Rotation = Controller->GetControlRotation();
		const FVector Direction = FRotationMatrix(Rotation).GetScaledAxis(EAxis::Z);

		//swim up
		AddMovementInput(Direction, 1.0f);
	}
	else
	{
		bPressedJump = false;
		bPressedJump = true;
	}
}

void AMyCharacter::OnStopJump()
{
	bPressedJump = false;
}

I’m pretty green when it comes to C++, so it might be something really obvious. This is the error the compiler throws: 1>------ Build started: Project: MyGame, Configuration: Development_Editor x64 - - Pastebin.com

Any help would be immensely appreciated.

I think IsInWater is a function, so you need:

if( CharacterMovement->IsInWater() )
{
        ...
}

also note that you don’t need the “== true”.

Yeah it’s a function.

Every boolean variable has b prefix.

That’s done it! Fantastic, thank you. Now to solve why the sucker isn’t actually moving up :stuck_out_tongue: