So now that I know how BP works and that stuff, Im learning how to use the C++ framework. I was able to make the character able to sprint and use a FP flashlight but now this is my problem.
I have 2 CameraAnims: 1 for walking and 1 for running/sprinting. The reason why I made them that way instead of CameraShake, its because it was easier and the results were so much better than the CameraShake. Im writing on the default FPS C++ template and this is the .cpp line:
void ALevelsGameCharacter::MoveForward(float Value)
{
APlayerController* PC = UGameplayStatics::GetPlayerController(this, 0);
if ((Value != 0.0f))
{
// add movement in that direction
bIsWalking = true;
AddMovementInput(GetActorForwardVector(), Value);
PC->ClientPlayCameraAnim(WalkBob, 1.0f, Value, 0.25f, 1.0f, true, true, ECameraAnimPlaySpace::CameraLocal, FRotator(0.0f, 0.0f, 0.0f));
}
}
So basically the function adds movement to the character and it starts a CameraAnim in the Local Camera (Player) to simulate a bobbing. Now I know I’ve set on the params to loop the Animation, but I want this because it looks so natural and good but whenever I stop walking, the CameraAnim still playing and I don’t want that. I don’t know where to place the: PC->ClientStopCameraAnim(WalkBob).
I tried linking the Scale Parameter with the Value parameter that the function gets, but it didn’t solve the problem.
Im not a C++ pro but I do know many stuff about this language, I was thinking to add a destructor but idk how and sometimes I think that is not the way to solve it.
Thanks