#ifndef BIRD_H #define BIRD_H /* Hostile bird character for 'Run the gauntlet' game Tim Redfern April 2012 ??how to manage visibility Bird should automatically stay within viewing volume of camera from the birds POV, The visible area is a frustrum extending down from the camera 1) like opensteer, extend the birds heading and decide whether this will hit the edge 2) have an actual model of the volume and work within it 3) how do we make the bird aware of players in front of it --> this all implies being able to take a sightline from the bird and determine -visibility of objects -distance to obstructions -build basic of time/speed/heading update/draw -basic anim cycle MAKING THE BIRD CHASE THE PLAYERS find distance to edge of play - alter turn behaviour depending on how bird needs to head detect player in FOV turn & swoop pick player and remove planes frustrum belongs to camera bird checks ray dist to planes avoids nearest +ve */ #include "ofMain.h" #include "morphmesh.h" #include "normBindTexture.h" #include "player.h" #include "outsidePolygon.h" #include "ofxRay.h" class bird { public: bird(); virtual ~bird(); void update(map& players,float angle,vector border); void draw(); void drawShadow(); void drawDebug(); string currentseq; morphmesh model; ofRay pointer; ofVec3f position; ofVec2f centrePoint; //2d coords of centre of screen vector playang; vector playhead; vector playdip; vector playdist; vector playpos; bool leaving; float centrehead; float heading; protected: private: float fieldofview; ofVec3f direction; float velocity; //per second float turnRate; //per second float diveRate; //per second float lastTime; ofImage texture; }; #endif // BIRD_H