Hi there. I created my first C++ first person template and I really don’t understand how input binding works in there. As you know we have a piece of code for inputs in character child class:
void AMyGame::SetupPlayerInputComponent(class UInputComponent* PlayerInputComponent)
{
// Set up gameplay key bindings
check(PlayerInputComponent);
PlayerInputComponent->BindAction("Jump", IE_Pressed, this, &ACharacter::Jump);
PlayerInputComponent->BindAction("Jump", IE_Released, this, &ACharacter::StopJumping);
}
and another piece for jump:
void AMyGame::TouchStarted(ETouchIndex::Type FingerIndex, FVector Location)
{
Jump();
}
void AMyGame::TouchStopped(ETouchIndex::Type FingerIndex, FVector Location)
{
StopJumping();
}
and this is the Jump function defined in ACharacter class:
void ACharacter::Jump()
{
bPressedJump = true;
JumpKeyHoldTime = 0.0f;
}
void ACharacter::StopJumping()
{
bPressedJump = false;
ResetJumpState();
}
So my question is what really makes my character jump?
If I want a set of condition before movements where should I do that? For example if character is in a certain region I want to disable the movements only. So where can I setup things like that?
It’s a pretty long question so thank you in advance.