Move some utility functions from Blueprint to C++

This commit is contained in:
2024-10-15 16:17:44 -04:00
parent 25dd7cabcb
commit ecbca6e5a2
5 changed files with 57 additions and 7 deletions

View File

@@ -5,10 +5,13 @@
#include "CoreMinimal.h"
#include "UtilityLibrary.generated.h"
class UEnhancedInputLocalPlayerSubsystem;
/**
*
* UlxUtilityLibrary is for functions that are just generally-useful functionality
* that Unreal includes, but for some reason was not made accessible to Blueprints.
* UlxUtilityLibrary is for functions that are aren't particularly luprex-specific,
* but rather, are just generally-useful functionality that could help in any
* Unreal program.
*
*/
UCLASS()
@@ -33,4 +36,20 @@ public:
//
UFUNCTION(BlueprintCallable, Meta = (DefaultToSelf = "target"), Category = "Luprex|Utility")
static FBox GetActorBounds(const AActor *target, bool bOnlyCollidingComponents = false, bool bIncludeFromChildActors = false);
// Add movement input, using the yaw of the control rotation to find a rightward vector.
//
UFUNCTION(BlueprintCallable, Meta = (DefaultToSelf = "target"), Category = "Pawn|Input")
static void AddMovementInputRightward(APawn *target, double ScaleValue=1.0, bool Force=false);
// Add movement input, using the yaw of the control rotation to find a forward vector.
//
UFUNCTION(BlueprintCallable, Meta = (DefaultToSelf = "target"), Category = "Pawn|Input")
static void AddMovementInputForward(APawn *target, double ScaleValue=1.0, bool Force=false);
// Get the enhanced input local player subsystem from a controller. If the controller
// is not a player controller, or if it is a player controller but it doesn't have an
// enhanced input subsystem, return nullptr.
UFUNCTION(BlueprintCallable, BlueprintPure, Category="Player Controller|Local Player Subsystems")
static UEnhancedInputLocalPlayerSubsystem *GetEnhancedInputLocalPlayerSubsystem(AController *Controller);
};