void Camera::KeyboardNumpad(InputManager &input, float factor) { //Use the numberpad to replace the mouse if(input.KeyCheck(KEY_NUMPAD4)) LookRight(-factor); if(input.KeyCheck(KEY_NUMPAD6)) LookRight(factor); if(input.KeyCheck(KEY_NUMPAD8)) LookUp(factor); if(input.KeyCheck(KEY_NUMPAD2)) LookUp(-factor); if(input.KeyCheck(KEY_NUMPAD7)) Roll(factor); if(input.KeyCheck(KEY_NUMPAD9)) Roll(-factor); }
void NaoHeadControl::execute() { switch(headMotionRequest.headMotionType) { case HeadMotionRequest::intelligencemode: IntelligenceMode(); break; case HeadMotionRequest::automode: AutoMode(); break; case HeadMotionRequest::handmode: HandMode(); break; case HeadMotionRequest::lookforward: LookForward(); break; case HeadMotionRequest::lookleft: LookLeft(); break; case HeadMotionRequest::lookright: LookRight(); break; case HeadMotionRequest::lookatball: LookAtBall(); break; case HeadMotionRequest::lookatourgoal: LookAtOurGoal(); break; case HeadMotionRequest::lookatoppgoal: LookAtOppGoal(); break; default: cerr << "There is No Such headMotionType!" << endl; } }
void Camera3::DecelerateLookRight(const double dt) { if(yawVelocity + (camAcceleration * camBrakeOffset * dt) < 0) { yawVelocity += camAcceleration * camBrakeOffset * dt; yawAngle += camAcceleration * camBrakeOffset * dt; LookRight(dt); } else { yawVelocity = 0.f; yawMovingRight = false; } }
void Camera3::Yaw(const double dt) { /******************** set flags *********************/ bool Left = Controller::getCameraYaw() < 0.f; bool Right = Controller::getCameraYaw() > 0.f; if(Left)//(+vel) { yawMovingLeft = true; } else if(Right)//(-vel) { yawMovingRight = true; } /******************** update *************************/ if(yawMovingRight || yawMovingLeft) { yawVelocity += -camAcceleration * Controller::getCameraYaw() * (float)dt; yawAngle += -camAcceleration * (float)dt; } /******************** cap *************************/ if(yawVelocity > CAMERA_MAX_VELOCITY) yawVelocity = CAMERA_MAX_VELOCITY; else if(yawVelocity < -CAMERA_MAX_VELOCITY) yawVelocity = -CAMERA_MAX_VELOCITY; /******************** decelerate *************************/ if(!Left && yawMovingLeft) DecelerateLookLeft(dt); else if(!Right && yawMovingRight) DecelerateLookRight(dt); if(Left) LookLeft(dt); else if(Right) LookRight(dt); }