void TDCamera::KeyboardInput(float fElapsedTime) { m_bRunning = (GetAsyncKeyState(VK_SHIFT) & 0x8000) != 0; m_bMoving = false; if (m_bRunning) m_fDistance = 30.f; else m_fDistance = 3.f; if (GetAsyncKeyState('E') & 0x8000) MoveCamera(EMCT_Vertical, fElapsedTime*m_fDistance); else if (GetAsyncKeyState('Q') & 0x8000) MoveCamera(EMCT_Vertical, -fElapsedTime*m_fDistance); if (GetAsyncKeyState('D') & 0x8000) MoveCamera(EMCT_Horizontal, fElapsedTime*m_fDistance); else if (GetAsyncKeyState('A') & 0x8000) MoveCamera(EMCT_Horizontal, -fElapsedTime*m_fDistance); if (GetAsyncKeyState('W') & 0x8000) MoveCamera(EMCT_Forward, fElapsedTime*m_fDistance); else if (GetAsyncKeyState('S') & 0x8000) MoveCamera(EMCT_Forward, -fElapsedTime*m_fDistance); if (GetAsyncKeyState(VK_UP) & 0x8000) RotateCameraDown(-fElapsedTime); else if (GetAsyncKeyState(VK_DOWN) & 0x8000) RotateCameraDown(fElapsedTime); if (GetAsyncKeyState(VK_LEFT) & 0x8000) RotateCameraRight(-fElapsedTime); else if (GetAsyncKeyState(VK_RIGHT) & 0x8000) RotateCameraRight(fElapsedTime); }
void AZombieShooterPlayerController::PlayerTick(float DeltaTime) { Super::PlayerTick(DeltaTime); FHitResult Hit; GetHitResultUnderCursor(ECC_Visibility, false, Hit); if (ControlledPawn) { FVector WorldLocation, WorldDirection; DeprojectMousePositionToWorld(WorldLocation, WorldDirection); ControlledPawn->WorldLocation = WorldLocation; ControlledPawn->WorldDirection = WorldDirection; } float MouseX = 0.0f, MouseY = 0.0f; GetMousePosition(MouseX, MouseY); if (bRotating) { RotateCameraRight((MouseX - LastMouseX) * CameraSensitivity); LastMouseX = MouseX; } }
void TDObserver::KeyboardInput(float fElapsedTime) { if (GetAsyncKeyState('I') & 0x8000) RotateCameraDown(-fElapsedTime); else if (GetAsyncKeyState('K') & 0x8000) RotateCameraDown(fElapsedTime); if (GetAsyncKeyState('J') & 0x8000) RotateCameraRight(-fElapsedTime); else if (GetAsyncKeyState('L') & 0x8000) RotateCameraRight(fElapsedTime); }