DIE Engine
Loading...
Searching...
No Matches
walker.h
Go to the documentation of this file.
1
11
12#ifndef WALKER_H
13#define WALKER_H
14
15#include "renderer.h"
16
17#include <QVector2D>
18#include <QVector3D>
19
20class Walker
21{
22public:
23 static constexpr float speedPan = 0.10f;
24 static constexpr float speedRun = 0.45f;
25 static constexpr float speedStrafe = 0.33f;
26 static constexpr float radius = 2.0f;
27 static constexpr float cameraPitch = 40.0f; // max gamepad pitch, in degrees
28
29 Walker();
30
31 void init();
32 void terminate();
33
35 void update();
36
37 QVector3D pos;
38 QVector3D speed;
39 QVector3D accel;
40 float pan;
41 float tilt;
44
46 bool onFloor;
48
49private:
50 void updateMove();
51 void updateGravity();
52 void updateCollisions();
53
54 bool intersect(const QVector2D & pos, float radius, const Renderer::Wall & w, QVector2D & result);
55};
56
57extern Walker walker;
58
59#endif // WALKER_H
Definition walker.h:21
QVector3D accel
Definition walker.h:39
bool onFloor
Definition walker.h:46
void init()
Definition walker.cpp:34
static constexpr float speedPan
Definition walker.h:23
void update()
Poll the gamepad, move the walker and update the editor viewpoint.
Definition walker.cpp:56
float pitchTargetPad
pitch from the gamepad
Definition walker.h:42
static constexpr float speedRun
Definition walker.h:24
static constexpr float cameraPitch
Definition walker.h:27
float tilt
Definition walker.h:41
int jumpCount
Definition walker.h:45
static constexpr float radius
Definition walker.h:26
QVector3D pos
Definition walker.h:37
static constexpr float speedStrafe
Definition walker.h:25
void terminate()
Definition walker.cpp:50
Walker()
Definition walker.cpp:24
float pitchTargetMouse
pitch from the mouse (set by the map view)
Definition walker.h:43
QVector3D speed
Definition walker.h:38
float pan
Definition walker.h:40
bool isFlying
Definition walker.h:47
Renderer-side wall (compact variant, fed by Map::pass).
Definition renderer.h:88
Walker walker
Definition walker.cpp:21