void AABPawn::SetupPlayerInputComponent(UInputComponent* PlayerInputComponent)
{
Super::SetupPlayerInputComponent(PlayerInputComponent);
PlayerInputComponent->BindAxis(TEXT("UpDown"),this,&AABPawn::UpDown); //마지막은 연동될 함수
PlayerInputComponent->BindAxis(TEXT("RightLeft"),this, &AABPawn::RightLeft);
}
void AABPawn::UpDown(float value)
{
AddMovementInput(GetActorForwardVector(), value);
}
void AABPawn::RightLeft(float value)
{
AddMovementInput(GetActorRightVector(), value);
}
바인딩
- 폰이 신호를 받을 수 있도록, 입력설정의 이름과 이와 연동할 언리얼 오브젝트 인스턴스의 함수포인터를 지정한다.
- BindAxis : 축 항목
- BindAction : 액션 항목
void AABCharacter::SetupPlayerInputComponent(UInputComponent* PlayerInputComponent)
{
Super::SetupPlayerInputComponent(PlayerInputComponent);
PlayerInputComponent->BindAction(TEXT("ViewChange"), EInputEvent::IE_Pressed, this, &AABCharacter::ViewChange);
PlayerInputComponent->BindAxis(TEXT("UpDown"),this, &AABCharacter::UpDown);
PlayerInputComponent->BindAxis(TEXT("RightLeft"), this, &AABCharacter::RightLeft);
PlayerInputComponent->BindAxis(TEXT("Turn"), this, &AABCharacter::Turn);
PlayerInputComponent->BindAxis(TEXT("LookUp"), this, &AABCharacter::LookUp);
}
'Unreal > Game 1 (C++)' 카테고리의 다른 글
6.3인칭 컨트롤 구현 (GTA 방식) (0) | 2019.05.02 |
---|---|
5.캐릭터 생성 (0) | 2019.05.02 |
4.애니메이션 재생 (0) | 2019.05.02 |
2.캐릭터에 들어가는 기본적인 항목 (0) | 2019.05.01 |
1.게임모드, 폰, 컨트롤러 (디폴트) (0) | 2019.05.01 |