Created
January 28, 2025 20:34
-
-
Save liana-p/c3611a4b9e57ab7d4145ae27dca41f7f to your computer and use it in GitHub Desktop.
BlasterCharacter.h with enhanced input actions for UE 5.1+
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Fill out your copyright notice in the Description page of Project Settings. | |
| #pragma once | |
| #include "CoreMinimal.h" | |
| #include "GameFramework/Character.h" | |
| #include "InputMappingContext.h" | |
| #include "BlasterCharacter.generated.h" | |
| // https://dev.epicgames.com/documentation/en-us/unreal-engine/enhanced-input-in-unreal-engine | |
| UCLASS() | |
| class BLASTER_API ABlasterCharacter : public ACharacter | |
| { | |
| GENERATED_BODY() | |
| public: | |
| // Sets default values for this character's properties | |
| ABlasterCharacter(); | |
| // Called every frame | |
| virtual void Tick(float DeltaTime) override; | |
| // Called to bind functionality to input | |
| virtual void SetupPlayerInputComponent(class UInputComponent* PlayerInputComponent) override; | |
| UPROPERTY(EditAnywhere, Category = Input) | |
| UInputMappingContext* InputMapping; | |
| UPROPERTY(EditAnywhere, Category = Input) | |
| UInputAction* MoveAction; | |
| UPROPERTY(EditAnywhere, Category = Input) | |
| UInputAction* LookAction; | |
| UPROPERTY(EditAnywhere, Category = Input) | |
| UInputAction* JumpAction; | |
| protected: | |
| // Called when the game starts or when spawned | |
| virtual void BeginPlay() override; | |
| void Move(const FInputActionInstance& Instance); | |
| void Look(const FInputActionInstance& Instance); | |
| void Jump(const FInputActionInstance& Instance); | |
| private: | |
| UPROPERTY(VisibleAnywhere, Category = Camera) | |
| class USpringArmComponent* CameraBoom; | |
| UPROPERTY(VisibleAnywhere, Category = Camera) | |
| class UCameraComponent* FollowCamera; | |
| }; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment