Unreal学习之处理转动和仰视

// 调用后将功能绑定到输入
void AFPSCharacter::SetupPlayerInputComponent(class UInputComponent* InputComponent)
{
    Super::SetupPlayerInputComponent(InputComponent);

    // 设置“移动”绑定。
    InputComponent->BindAxis("MoveForward", this, &AFPSCharacter::MoveForward);
    InputComponent->BindAxis("MoveRight", this, &AFPSCharacter::MoveRight);

    // 设置“查看”绑定。
    InputComponent->BindAxis("Turn", this, &AFPSCharacter::AddControllerYawInput);
    InputComponent->BindAxis("LookUp", this, &AFPSCharacter::AddControllerPitchInput);
}

现在即可添加代码,处理转动和仰视的鼠标输入。Character 基类定义两个必要函数:

  • AddControllerYawInput

  • AddControllerPitchInput

posted @ 2018-12-27 14:51  Cober_kuang  阅读(34)  评论(0编辑  收藏  举报