OrbitCamera.h 911 B

123456789101112131415161718192021222324252627282930313233
  1. // ----------------------------------------------------------------
  2. // From Game Programming in C++ by Sanjay Madhav
  3. // Copyright (C) 2017 Sanjay Madhav. All rights reserved.
  4. //
  5. // Released under the BSD License
  6. // See LICENSE in root directory for full details.
  7. // ----------------------------------------------------------------
  8. #pragma once
  9. #include "CameraComponent.h"
  10. class OrbitCamera : public CameraComponent
  11. {
  12. public:
  13. OrbitCamera(class Actor* owner);
  14. void Update(float deltaTime) override;
  15. float GetPitchSpeed() const { return mPitchSpeed; }
  16. float GetYawSpeed() const { return mYawSpeed; }
  17. void SetPitchSpeed(float speed) { mPitchSpeed = speed; }
  18. void SetYawSpeed(float speed) { mYawSpeed = speed; }
  19. private:
  20. // Offset from target
  21. Vector3 mOffset;
  22. // Up vector of camera
  23. Vector3 mUp;
  24. // Rotation/sec speed of pitch
  25. float mPitchSpeed;
  26. // Rotation/sec speed of yaw
  27. float mYawSpeed;
  28. };