Cogs.Core
FPSNavigationComponent.h
1#include "../Core/DynamicComponent.h"
2
3#include "../../Context.h"
4
5#include <glm/vec3.hpp>
6#include <glm/fwd.hpp>
7
8#include <vector>
9
10namespace Cogs
11{
12 namespace Core
13 {
14 class TransformComponent;
16 {
17 public:
18 static void registerType();
19 void initialize(Cogs::Core::Context * context);
20 void update();
21
22 bool enable = true;
23 bool enablePitch = false;
24
25 float maxLinearSpeed = 10.f / 3.6f; //10 km/h
26 float maxAngularSpeed = 2.f; // 2 rads pr sec.
27
28 std::string axisForward = "Forward";
29 std::string axisRight = "Right";
30 std::string axisUp = "Up";
31 std::string axisDown = "Down";
32 std::string axisRotateUp = "RotateUp";
33 std::string axisRotateRight = "RotateRight";
34
35 std::string actionRun = "Run";
36 std::string actionEnableNavigation = "";
37
38 float pitch = 0;
39 float yaw = 0;
40
41 private:
42 glm::vec3 getOffset();
43 glm::vec2 getPitchYawOffset();
44
45 Context * context = nullptr;
46 };
47 }
48}
49
50template<> inline Cogs::StringView getName<Cogs::Core::FPSNavigationComponent>() { return "FPSNavigationComponent"; }
A Context instance contains all the services, systems and runtime components needed to use Cogs.
Definition: Context.h:83
Base class for components implementing dynamic behavior.
Provides a weakly referenced view over the contents of a string.
Definition: StringView.h:24
Contains all Cogs related functionality.
Definition: FieldSetter.h:23