Add code and animations for custom third person character
+ Adds sprinting and crouching, blends between all animations states + Followed tutorial: https://docs.unrealengine.com/4.27/en-US/InteractiveExperiences/HowTo/CharacterMovement/
This commit is contained in:
45
Source/ThirdPerson/Public/ThirdPersonCharacter.h
Normal file
45
Source/ThirdPerson/Public/ThirdPersonCharacter.h
Normal file
@@ -0,0 +1,45 @@
|
||||
// All content (c) Shaun Reed 2021, all rights reserved
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "CoreMinimal.h"
|
||||
#include "GameFramework/Character.h"
|
||||
#include "ThirdPersonCharacter.generated.h"
|
||||
|
||||
UCLASS()
|
||||
class THIRDPERSON_API AThirdPersonCharacter : public ACharacter
|
||||
{
|
||||
GENERATED_BODY()
|
||||
|
||||
public:
|
||||
// Sets default values for this character's properties
|
||||
AThirdPersonCharacter();
|
||||
|
||||
protected:
|
||||
// Called when the game starts or when spawned
|
||||
virtual void BeginPlay() override;
|
||||
|
||||
UPROPERTY(VisibleAnywhere, BlueprintReadWrite)
|
||||
class USpringArmComponent* SpringArmComp;
|
||||
|
||||
UPROPERTY(VisibleAnywhere, BlueprintReadWrite)
|
||||
class UCameraComponent* CameraComp;
|
||||
|
||||
// Input actions
|
||||
void SpawnActors();
|
||||
void DestroyActors();
|
||||
void MoveForward(float InputAxis);
|
||||
void MoveRight(float InputAxis);
|
||||
void BeginSprint();
|
||||
void EndSprint();
|
||||
void BeginCrouch();
|
||||
void EndCrouch();
|
||||
|
||||
public:
|
||||
// Called every frame
|
||||
virtual void Tick(float DeltaTime) override;
|
||||
|
||||
// Called to bind functionality to input
|
||||
virtual void SetupPlayerInputComponent(class UInputComponent* PlayerInputComponent) override;
|
||||
|
||||
};
|
||||
Reference in New Issue
Block a user