[過去ログ] 【UE4】Unreal Engine 4 初心者質問スレッド part6 (1002レス)
上下前次1-新
このスレッドは過去ログ倉庫に格納されています。
次スレ検索 歴削→次スレ 栞削→次スレ 過去ログメニュー
276(3): 2019/12/14(土)01:59 ID:uNgHVJ3i(1/3) AAS
void APlayerControllerBase::BeginPlay(){
Character = GetCharacter();
InputComponent = Character->FindComponentByClass<UInputComponent>();
MovementComponent = Character->GetCharacterMovement();
SetupInputComponent();
}
void APlayerControllerBase::SetupInputComponent(){
InputComponent->BindAxis("MoveForward", this, &APlayerControllerBase::MoveForward);
InputComponent->BindAxis("MoveRight", this, &APlayerControllerBase::MoveRight);
InputComponent->BindAxis("TurnRate", this, &APlayerControllerBase::TurnAtRate);
InputComponent->BindAxis("LookUpRate", this, &APlayerControllerBase::LookUpAtRate);
}
void APlayerControllerBase::MoveForward(float Value){
const FRotator Rotation = GetControlRotation();
const FRotator YawRotation(0, Rotation.Yaw, 0);
const FVector Direction = FRotationMatrix(YawRotation).GetUnitAxis(EAxis::X);
Character->AddMovementInput(Direction, Value);
}
void APlayerControllerBase::MoveRight(float Value){
const FRotator Rotation = GetControlRotation();
const FRotator YawRotation(0, Rotation.Yaw, 0);
const FVector Direction = FRotationMatrix(YawRotation).GetUnitAxis(EAxis::Y);
Character->AddMovementInput(Direction, Value);
}
void APlayerControllerBase::TurnAtRate(float Rate){
CharacterIns->AddControllerYawInput(Rate * BaseTurnRate * GetWorld()->GetDeltaSeconds());
}
void APlayerControllerBase::LookUpAtRate(float Rate){
CharacterIns->AddControllerPitchInput(Rate * BaseLookUpRate * GetWorld()->GetDeltaSeconds());
}
上下前次1-新書関写板覧索設栞歴
あと 726 レスあります
スレ情報 赤レス抽出 画像レス抽出 歴の未読スレ AAサムネイル
ぬこの手 ぬこTOP 0.010s