/******************************************************************************** Pitch. You can add in a deadzone here. ********************************************************************************/ void Camera3::Pitch(const double dt) { if ( Application::camera_pitch > 0.0 ) LookUp( -Application::camera_pitch * dt ); else if ( Application::camera_pitch < 0.0 ) LookDown( -Application::camera_pitch * dt ); }
void Camera3::DecelerateDown(const double dt) { if(pitchVelocity + (camAcceleration * camBrakeOffset * dt) < 0) { pitchVelocity += camAcceleration * camBrakeOffset * dt; LookDown(dt); } else { pitchVelocity = 0.f; pitchMovingDown = false; } }
void Camera3::Pitch(const double dt) { /******************** set flags *********************/ bool Up = Controller::getCameraPitch() < 0.f; bool Down = Controller::getCameraPitch() > 0.f; if(Up) { pitchMovingUp = true; } else if(Down) { pitchMovingDown = true; } /******************** update *************************/ if(pitchMovingUp || pitchMovingDown) //pitch < 0 pitchVelocity += -camAcceleration * Controller::getCameraPitch() * (float)dt; /******************** cap *************************/ if(pitchVelocity > CAMERA_MAX_VELOCITY) pitchVelocity = CAMERA_MAX_VELOCITY; else if(pitchVelocity < -CAMERA_MAX_VELOCITY) pitchVelocity = -CAMERA_MAX_VELOCITY; /******************** decelerate *************************/ if(!Up && pitchMovingUp) DecelerateUp(dt); else if(!Down && pitchMovingDown) DecelerateDown(dt); if(Up) LookUp(dt); else if(Down) LookDown(dt); }