Updated TempCharacter

Added Jump function which is using ACharacter and started working on custom Sneak function
This commit is contained in:
MARCEL HARA 2023-02-06 14:30:13 +00:00
parent 19a53529e9
commit 0cf4ace43a
4 changed files with 17 additions and 4 deletions

Binary file not shown.

Binary file not shown.

View File

@ -38,6 +38,11 @@ void ATempCharacter::RightMoveInput(float Axis)
AddMovementInput(UKismetMathLibrary::GetRightVector(FRotator(0, GetControlRotation().Yaw, 0)) * Axis); AddMovementInput(UKismetMathLibrary::GetRightVector(FRotator(0, GetControlRotation().Yaw, 0)) * Axis);
} }
void ATempCharacter::Sneak()
{
}
// Called every frame // Called every frame
void ATempCharacter::Tick(float DeltaTime) void ATempCharacter::Tick(float DeltaTime)
@ -53,6 +58,8 @@ void ATempCharacter::SetupPlayerInputComponent(UInputComponent* PlayerInputCompo
PlayerInputComponent->BindAxis(TEXT("Move Right / Left"), this, &ATempCharacter::RightMoveInput); PlayerInputComponent->BindAxis(TEXT("Move Right / Left"), this, &ATempCharacter::RightMoveInput);
PlayerInputComponent->BindAxis(TEXT("Turn Right / Left Mouse"), this, &ATempCharacter::AddControllerYawInput); PlayerInputComponent->BindAxis(TEXT("Turn Right / Left Mouse"), this, &ATempCharacter::AddControllerYawInput);
PlayerInputComponent->BindAxis(TEXT("Look Up / Down Mouse"), this, &ATempCharacter::AddControllerPitchInput); PlayerInputComponent->BindAxis(TEXT("Look Up / Down Mouse"), this, &ATempCharacter::AddControllerPitchInput);
PlayerInputComponent->BindAction(TEXT("Jump"), IE_Pressed, this, &ATempCharacter::Jump);
PlayerInputComponent->BindAction(TEXT("Sneak"), IE_Pressed, this, &ATempCharacter::Sneak);
PlayerInputComponent->BindAction("Interact", IE_Pressed, this, &ATempCharacter::KeyPressed); PlayerInputComponent->BindAction("Interact", IE_Pressed, this, &ATempCharacter::KeyPressed);
} }
@ -62,6 +69,8 @@ void ATempCharacter::KeyPressed()
LineTraceLogic(); LineTraceLogic();
} }
// Line trace logic // Line trace logic
void ATempCharacter::LineTraceLogic() void ATempCharacter::LineTraceLogic()
{ {

View File

@ -25,6 +25,9 @@ protected:
void ForwardInput(float Axis); void ForwardInput(float Axis);
void RightMoveInput(float Axis); void RightMoveInput(float Axis);
UFUNCTION()
void Sneak();
public: public:
// Called every frame // Called every frame
virtual void Tick(float DeltaTime) override; virtual void Tick(float DeltaTime) override;
@ -80,5 +83,6 @@ public:
UPROPERTY(BlueprintReadWrite) UPROPERTY(BlueprintReadWrite)
bool disableTab = false; bool disableTab = false;
}; };