MCPcopy Create free account
hub / github.com/Vaei/TurnInPlace / UpdateAnimGraphData

Method UpdateAnimGraphData

Source/ActorTurnInPlace/Private/TurnInPlace.cpp:931–974  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

929 return true;
930 }
931
932 // We've started moving, CMC can take over by calling Super::PhysicsRotation()
933 TurnData = {}; // Cull turn offset when we start moving, it will be recalculated when we stop moving
934 return false;
935}
936
937FTurnInPlaceAnimGraphData UTurnInPlace::UpdateAnimGraphData(float DeltaTime) const
938{
939 FTurnInPlaceAnimGraphData AnimGraphData;
940 if (!HasValidData())
941 {
942 return AnimGraphData;
943 }
944
945 TRACE_CPUPROFILER_EVENT_SCOPE(UTurnInPlace::UpdateAnimGraphData);
946
947 // Get the current turn in place anim set & parameters from the animation blueprint
948 AnimGraphData.AnimSet = GetTurnInPlaceAnimSet();
949 const FTurnInPlaceParams Params = AnimGraphData.AnimSet.Params;
950
951 // Determine the enabled state of turn in place
952 const ETurnInPlaceEnabledState State = GetEnabledState(Params);
953
954 // Retrieve parameters for the current frame required by the animation graph
955 const float& TurnOffset = GetTurnOffset();
956 AnimGraphData.TurnOffset = TurnOffset;
957 AnimGraphData.bIsTurning = IsTurningInPlace();
958 AnimGraphData.StepSize = DetermineStepSize(Params, TurnOffset, AnimGraphData.bTurnRight);
959 AnimGraphData.TurnModeTag = GetTurnModeTag();
960 AnimGraphData.bWantsPseudoAnimState = WantsPseudoAnimState();
961
962 // Abort the turn if we became unable to turn in place during a turn
963 AnimGraphData.bAbortTurn = State != ETurnInPlaceEnabledState::Enabled && CanAbortTurnAnimation();
964
965 // Determine if we have valid turn angles for the current turn mode tag and cache the result
966 if (const FTurnInPlaceAngles* TurnAngles = Params.GetTurnAngles(GetTurnModeTag()))
967 {
968 AnimGraphData.TurnAngles = *TurnAngles;
969 AnimGraphData.bHasValidTurnAngles = true;
970 AnimGraphData.bWantsToTurn = State != ETurnInPlaceEnabledState::Locked && Params.StepSizes.Num() > 0 &&
971 FMath::Abs(TurnOffset) >= TurnAngles->MinTurnAngle;
972 }
973 else
974 {
975 AnimGraphData.bHasValidTurnAngles = false;
976 UE_LOG(LogTurnInPlace, Warning, TEXT("No TurnAngles found for TurnModeTag: %s"), *AnimGraphData.TurnModeTag.ToString());
977 }

Callers 1

UpdateTurnInPlaceMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected