2
0

FPSCamera.h 915 B

1234567891011121314151617181920212223242526272829303132
  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 FPSCamera : public CameraComponent
  11. {
  12. public:
  13. FPSCamera(class Actor* owner);
  14. void Update(float deltaTime) override;
  15. float GetPitch() const { return mPitch; }
  16. float GetPitchSpeed() const { return mPitchSpeed; }
  17. float GetMaxPitch() const { return mMaxPitch; }
  18. void SetPitchSpeed(float speed) { mPitchSpeed = speed; }
  19. void SetMaxPitch(float pitch) { mMaxPitch = pitch; }
  20. private:
  21. // Rotation/sec speed of pitch
  22. float mPitchSpeed;
  23. // Maximum pitch deviation from forward
  24. float mMaxPitch;
  25. // Current pitch
  26. float mPitch;
  27. };