2024-04-29
깃허브! |
---|
https://github.com/ChangJin-Lee/ARproject |
★ https://github.com/ChangJin-Lee/ToonTank |
느낀점
3D 3인칭 게임에서 플레이어의 움직임과 마우스 이동법에 대해서 학습했다. project settings에서 정의해놓은 input axis 와 action을 가져와서 사용했다. 빠르게 플레이어의 이동을 만들 수 있었다.
https://dev.epicgames.com/documentation/en-us/unreal-engine/API/Runtime/Engine/GameFramework/APawn/AddMovementInput?application_version=5.3
https://dev.epicgames.com/documentation/en-us/unreal-engine/API/Runtime/Engine/GameFramework/APawn/AddControllerPitchInput?application_version=5.3
https://dev.epicgames.com/documentation/en-us/unreal-engine/API/Runtime/Engine/GameFramework/APawn/AddControllerPitchInput?application_version=5.3
https://dev.epicgames.com/documentation/en-us/unreal-engine/API/Runtime/Engine/GameFramework/APawn/AddControllerYawInput?application_version=5.3
private:
void MoveForward(float AxisValue);
void MoveRight(float AxisValue);
void AShooterCharacter::MoveForward(float AxisValue)
{
AddMovementInput(GetActorForwardVector() * AxisValue);
}
void AShooterCharacter::MoveRight(float AxisValue)
{
AddMovementInput(GetActorRightVector() * AxisValue);
}
https://dev.epicgames.com/documentation/en-us/unreal-engine/API/Runtime/Engine/Components/UInputComponent/BindAxis/2?application_version=5.3
https://dev.epicgames.com/documentation/en-us/unreal-engine/API/Runtime/Engine/Components/UInputComponent/BindAction/2?application_version=5.3
template<class UserClass>
FInputActionBinding & BindAction
&40;
const FName ActionName,
const EInputEvent KeyEvent,
UserClass &42; Object,
typename FInputActionHandlerWithKeySignature::TMethodPtr< UserClass > Func
&41;
// Called to bind functionality to input
void AShooterCharacter::SetupPlayerInputComponent(UInputComponent* PlayerInputComponent)
{
Super::SetupPlayerInputComponent(PlayerInputComponent);
PlayerInputComponent->BindAxis(TEXT("MoveForward"), this, &AShooterCharacter::MoveForward);
PlayerInputComponent->BindAxis(TEXT("MoveRight"), this, &AShooterCharacter::MoveRight);
PlayerInputComponent->BindAction(TEXT("Jump"), EInputEvent::IE_Pressed, this, &ACharacter::Jump);
PlayerInputComponent->BindAxis(TEXT("LookUp"), this, &APawn::AddControllerPitchInput);
PlayerInputComponent->BindAxis(TEXT("LookRight"), this, &APawn::AddControllerYawInput);
// PlayerInputComponent->BindAction(TEXT("LookUp"), this, AShooterCharacter::LookUp);
}