]> git.localhorst.tv Git - space.git/blobdiff - src/ai/Autopilot.h
less sucky autopilot
[space.git] / src / ai / Autopilot.h
index b15448ea3a117be6469cd533b38be7c96c6275e0..1a814e6c6aaf01de9283746e7db8fe82137d61f3 100644 (file)
@@ -20,13 +20,54 @@ public:
 
        void Render(Canvas &, const Camera &) const;
 
+private:
+       // velocity is so small that the next integration makes no difference
+       bool StandingStill() const;
+       // can halt within the current frame
+       bool ReallySlow() const;
+       // can halt within one second
+       bool Slow() const;
+
+       // pointing exactly at target
+       bool FacingTarget() const;
+       // pointing exactly away from target
+       bool FacingOpposite() const;
+       // ship pointing in direction of given normalized vector
+       bool Facing(Vector<float>) const;
+       bool OnTarget() const;
+
+       float Speed() const;
+       float Distance() const;
+       float DistanceToHalt() const;
+       bool ReallyClose() const;
+       bool InBrakingDistance() const;
+       bool FarAway() const;
+
+       float TargetVelAngle() const;
+
+       // point the ship towards the target
+       void FaceTarget();
+       // point ship into direction of given normalized vector
+       void Face(Vector<float>);
+       // stop the ship asap
+       void Halt();
+       // accelerate if it improves moving in given normalized direction
+       void AccelerateAlong(Vector<float>);
+
 private:
        Ship *ctrl;
        const Vector<float> *target;
 
-       // cache members for debug drawing
-       Vector<float> planFrom;
-       Vector<float> planTo;
+       float dt;
+
+       Vector<float> dp;
+       float dist;
+       Vector<float> normDP;
+
+       float speed;
+       Vector<float> normVel;
+
+       Vector<float> proj;
 
 };