Hi!
Has anyone tried using the Chooser plugin in code?
I want to rewrite a BP Evaluate Chooser
node (screen 1) to C++ code, but I don’t understand how to do it correctly.
.h file
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "Player|Anim", meta = (AllowPrivateAccess = "true"))
TObjectPtr<class UChooserTable> AnimChooserTable = nullptr;
.cpp file
FTraversalChooserInputs* chooserInputs = new FTraversalChooserInputs(
TraversalResult->ActionType,
TraversalResult->HasFrontLedge,
TraversalResult->HasBackLedge,
TraversalResult->HasBackFloor,
TraversalResult->ObstacleHeight,
TraversalResult->ObstacleDepth,
TraversalResult->BackLedgeHeight,
GetCharacterMovement()->MovementMode,
Gait,
UKismetMathLibrary::VSizeXY(GetCharacterMovement()->Velocity)
);
FTraversalChooserOutputs* chooserOutputs;
TArray<UAnimMontage*> validMontages = UChooserFunctionLibrary::EvaluateChooserMulti(chooserInputs, AnimChooserTable, UAnimMontage::StaticClass());
// OR
TArray<UAnimMontage*> validMontages = UChooserFunctionLibrary::EvaluateObjectChooserBaseMulti(AnimChooserTable, chooserInputs, UAnimMontage::StaticClass());
I have 3 problems (questions):
-
Which fun is appropriate (or neither)? (screen 2 and screen 3)
-
How to correctly pass a struct rather than a class?
-
In addition to the result (TArray<UAnimMontage*>), how can I fill out the struct FTraversalChooserOutputs?
I will be glad for any help