I am making an interactable actor and I am not sure what to do with my axis value when I call my function. H file:
void BindToActor(UInputComponent* inputComponent);
void StartAnimation(float Val);
UFUNCTION()
void TimelineProgress(float Value);
FTimeline FCurveTimeline;
UPROPERTY(EditAnywhere,Category = "Movement")
UCurveFloat* CurveFloat;
UPROPERTY()
FRotator StartLoc;
UPROPERTY()
FRotator EndLoc;
UPROPERTY(EditAnywhere,Category = "Timeline")
float ZOffset;
cpp:
void AInteractBase::BeginPlay()
{
Super::BeginPlay();
StartAnimation(); ??
}
void AInteractBase::BindToActor(UInputComponent* inputComponent)
{
InputComponent->BindAxis("TurnRight", this, &AInteractBase::StartAnimation);
}
void AInteractBase::StartAnimation(float Val)
{
FOnTimelineFloat TimelineProgress;
TimelineProgress.BindUFunction(this, FName("TimelineProgress"));
FCurveTimeline.AddInterpFloat(CurveFloat, TimelineProgress);
FCurveTimeline.SetLooping(true);
StartLoc = EndLoc = GetActorRotation();
FCurveTimeline.PlayFromStart();
EndLoc.Yaw += Val;
}
void AInteractBase::TimelineProgress(float Value)
{
FRotator NewLocation = FMath::Lerp(StartLoc, EndLoc, Value);
SetActorRotation(NewLocation);
}
Well I need to call my start animation function in beginplay() for it to start, but what happens to axis value? notice
EndLoc.Yaw += Val; in my startanimation function, when I call it, it says I need to add function parameters when I already have an access value that is attached to my “TurnRight” BindAxis, what am I supposed to do ?