4 #include "../graphics/const.h"
5 #include "../graphics/Vector.h"
25 Vector<float> Dir() const {
26 return Vector<float>::FromPolar(1, orient);
28 float MaxFwdAcc() const {
29 return linForce / mass;
31 float MaxRevAcc() const {
32 return revForce / mass;
34 float MaxLinAcc() const {
35 return (linThrottle < 0 ? MaxRevAcc() : MaxFwdAcc());
37 Vector<float> Acc() const {
38 return Dir() * MaxLinAcc() * linThrottle;
43 float MaxRotAcc() const {
44 return rotForce / mass;
46 float RotAcc() const {
47 return MaxRotAcc() * rotThrottle;
50 float linThrottle = 0;
51 float rotThrottle = 0;
54 void Update(float delta) {
55 rotVel += RotAcc() * delta;
56 orient += rotVel * delta;
57 while (orient < 0) orient += PI2;
58 while (orient > PI2) orient -= PI2;