Hi
I’m trying to works with curves and Timeline. In blueprint, it’s possible to use multiple curves in one TimeLine like this:
I try to do the same in C++ but i’ve only one variable which is take in account. This is how i initialize my timeline.
FOnTimelineEvent SizeChangeEnd= FOnTimelineEvent();
SizeChangeEnd.BindUFunction(this, FName("SizeChangeEnd"));
progressFunction.BindUFunction(this, "UpdateSize");
static ConstructorHelpers::FObjectFinder<UCurveFloat> Curvy2(TEXT("/Game/_Rescale/_Blueprints/AnimationCurves/Anim_CubeAutoSiwtch"));
if (Curvy2.Object != NULL) {
SwitchAutoAlpha = Curvy2.Object;
}
else {
UE_LOG(LogTemp, Warning, TEXT("Null"));
}
TScaleTransition.AddInterpFloat(SwitchAutoAlpha, progressFunction,FName("AutoAlpha"), FName("AutoAlpha"));
static ConstructorHelpers::FObjectFinder<UCurveFloat> Curvy(TEXT("/Game/_Rescale/_Blueprints/AnimationCurves/Anim_CubeInteractableSwitch"));
if (Curvy.Object != NULL) {
SwitchInteracAlpha = Curvy.Object;
}
else {
UE_LOG(LogTemp, Warning, TEXT("Null"));
}
TScaleTransition.AddInterpFloat(SwitchInteracAlpha, progressFunction, FName("InteracAlpha"), FName("InteracAlpha"));
static ConstructorHelpers::FObjectFinder<UCurveFloat> Curvy3(TEXT("/Game/_Rescale/_Blueprints/AnimationCurves/Anim_ScalableColor"));
if (Curvy3.Object != NULL) {
AnimScalableColor = Curvy3.Object;
}
else {
UE_LOG(LogTemp, Warning, TEXT("Null"));
}
TScaleTransition.AddInterpFloat(AnimScalableColor, progressFunction, FName("ScalableColor"), FName("ScalableColor"));
TScaleTransition.SetTimelineFinishedFunc(SizeChangeEnd);
All my resources are correctly loaded but i the second and third argument of UpdateSize aren’t changed by the curves. I got either 0 or an aberrant number. But my first argument is correct. Here is UpdateSize:
void AScalableGeometry::UpdateSize(float InteracAlpha, float ScalableColor, float AutoAlpha)
{
if (ScalableColor == 1) {
ColorAlphaReachedOne = true;
}
if (isAuto) {
CurrentScale = FMath::Lerp(ScaleLevels[SavedScaleIndex], ScaleLevels[TargetScaleIndex], AutoAlpha);
}
else {
CurrentScale = FMath::Lerp(ScaleLevels[SavedScaleIndex], ScaleLevels[TargetScaleIndex], InteracAlpha);
}
SetActorScale3D(FVector(CurrentScale));
Color(InteracAlpha, ScalableColor, AutoAlpha);
if (CheckCollide() || CollidedDuringRescale) {
CollidedDuringRescale = true;
}
}
If someone has an idea, thanks in advance.