FpsCharacterNode.h 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. // Copyright (C) 2009-present, Panagiotis Christopoulos Charitos and contributors.
  2. // All rights reserved.
  3. // Code licensed under the BSD License.
  4. // http://www.anki3d.org/LICENSE
  5. #pragma once
  6. #include <AnKi/AnKi.h>
  7. #include <Samples/PhysicsPlayground/GrenadeNode.h>
  8. using namespace anki;
  9. ANKI_CVAR(NumericCVar<F32>, Game, Fov, 90.0f, 60.0f, 110.0f, "Field of view")
  10. ANKI_CVAR(NumericCVar<F32>, Game, MouseLookPower, 5.0f, 1.0f, 100.0f, "Mouselook")
  11. class FpsCharacter : public SceneNode
  12. {
  13. public:
  14. F32 m_walkingSpeed = 8.5f;
  15. F32 m_jumpSpeed = 8.0f;
  16. Bool m_crouching = false;
  17. U8 m_shotgunBulletCount = 8;
  18. F32 m_shotgunSpreadAngle = 6.0_degrees;
  19. F32 m_shotgunMaxLength = 100.0f;
  20. F32 m_shotgunForce = 80.0f;
  21. Vec3 m_shotgunRestingPosition = Vec3(0.1f, -0.18f, -0.19f);
  22. Euler m_shotgunRestingRotation = Euler(0.0f, kPi, 0.0f);
  23. SceneNode* m_cameraNode = nullptr;
  24. SceneNode* m_shotgunNode = nullptr;
  25. FpsCharacter(CString name);
  26. void frameUpdate([[maybe_unused]] Second prevUpdateTime, [[maybe_unused]] Second crntTime) override;
  27. private:
  28. void fireShotgun();
  29. void fireGrenade();
  30. };