-
Notifications
You must be signed in to change notification settings - Fork 2
/
Airplane.h
68 lines (47 loc) · 1.5 KB
/
Airplane.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
#include "Game.h"
#include "Object.h"
#include "AirplaneState.h"
class Airplane : public Object {
AirplaneState state;
bool engineOn;
bool crashed;
bool thrustInc, thrustDec, pitchInc, pitchDec, rollInc, rollDec, yawInc, yawDec;
float delay;
unsigned int alSource;
Ogre::ParticleSystem * engineParticles;
public:
static const Ogre::String SCENE_NODE_NAME;
Airplane(Game *, Ogre::SceneNode *, const AirplaneState&);
~Airplane();
void update(float dt);
float getThrust() const { return state.thrust; }
void setThrust(float thrustAmount);
bool atMaximumThrust() const;
const Ogre::Vector3& getPosition() const { return state.position; }
const Ogre::Vector3& getVelocity() const { return state.velocity; }
const AirplaneState& getState() const { return state; }
Ogre::Radian getPitch() const;
Ogre::Radian getRoll() const;
Ogre::Radian getYaw() const;
void stopEngine();
void increaseThrust();
void decreaseThrust();
void pitchUp();
void pitchDown();
void rollLeft();
void rollRight();
void yawLeft();
void yawRight();
private:
Ogre::Vector3 thrust() const;
Ogre::Vector3 lift() const;
Ogre::Vector3 drag() const;
Ogre::Vector3 weight() const;
Ogre::Vector3 netForce() const;
static float liftCoefficient(float aoa);
static float dragCoefficient(float aoa);
void checkGroundCollision();
void land();
void crash();
void updateSound();
};