Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void ABDPlayerController::MoveForward(float Value)
- {
- if (Value != 0.0f)
- {
- // find out which way is forward
- const FRotator Rotation = GetControlRotation();
- const FRotator YawRotation(0, Rotation.Yaw, 0);
- // get forward vector
- const FVector Direction = FRotationMatrix(YawRotation).GetUnitAxis(EAxis::X);
- GetPawn()->AddMovementInput(Direction, Value);
- }
- }
- void ABDPlayerController::MoveRight(float Value)
- {
- if (Value != 0.0f)
- {
- // find out which way is right
- const FRotator Rotation = GetControlRotation();
- const FRotator YawRotation(0, Rotation.Yaw, 0);
- // get right vector
- const FVector Direction = FRotationMatrix(YawRotation).GetUnitAxis(EAxis::Y);
- // add movement in that direction
- GetPawn()->AddMovementInput(Direction, Value);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement