void ABrowserCharacter::MoveUp(float Val) { if ((Val != 0.0f) && (Controller != NULL) && bEnable3D) { const FRotator Rotation = Controller->GetControlRotation(); const FRotationMatrix R = FRotationMatrix(FRotator(Rotation.Pitch, 0, Rotation.Roll)); const FVector WorldSpaceAccel = R.GetScaledAxis(EAxis::Z); AddMovementInput(WorldSpaceAccel, Val * SpeedZ * (CHARACTER_MOVEMENT_SPEED(cameraZoom_current))); } }
void ABrowserCharacter::MoveRight(float Val) { if ((Val != 0.0f) && (Controller != NULL)) { const FRotator Rotation = Controller->GetControlRotation(); const FRotationMatrix R = FRotationMatrix(FRotator(0, Rotation.Yaw, 0)); const FVector WorldSpaceAccel = R.GetScaledAxis(EAxis::Y); AddMovementInput(WorldSpaceAccel, Val * SpeedY * (CHARACTER_MOVEMENT_SPEED(cameraZoom_current))); } }
void UBerserkCameraComponent::MoveRight(float value) { auto ownerPawn = GetOwnerPawn(); if (ownerPawn != nullptr) { auto playerController = GetPlayerController(); if ((value != 0.f) && (playerController != nullptr)) { const FRotationMatrix cameraRotation(playerController->PlayerCameraManager->GetCameraRotation()); const FVector worldSpaceAccel = cameraRotation.GetScaledAxis(EAxis::Y) * 100.0f; // transform to world space and add it ownerPawn->AddMovementInput(worldSpaceAccel, value); } } }