AIUnit::AIUnit(Vector3D pos, Scalar orient, Vector3D vel, Scalar rot, int size) //This constructor will initialize the values where //pos is a Vector for the triangle's position, //orient is its orientation in radians //vel is its initial velocity //rot is its initial angular velocity { body = Triangle3D(Vector3D(pos[X]+(20*cos(orient)),pos[Y]+(20*sin(orient)),0), Vector3D(pos[X]+(20*cos(orient+2.5)),pos[Y]+(20*sin(orient+2.5)),0), Vector3D(pos[X]+(20*cos(orient-2.5)),pos[Y]+(20*sin(orient-2.5)),0)); //Initializes a triangle using pos and orient kinematic = Kinematic(pos,orient,vel,rot); //Initializes the physics for the character appearance = Appearance(Color(1,0,0),true); //Starts the color as red steering = SteeringOutput(Vector3D(0,0,0),0.0); //Initializes the steering at zero steeringNum = 3; //Starts the steering with Blended Steering //Initialize the booleans defeatPlayer = false; dying = false; spawnNewAI = false; fast = false; wanderer = false; windowSize = size; //set the window size fsm = AI_FSM(); //Initialize the state machine }
Kinematic Kinematic::getLinearKinematic(hpvec3 start, hpvec3 end){ hpvec3 delta = end - start; return Kinematic(Polynom<double>(2,start.x, delta.x), Polynom<double>(2,start.y, delta.y), Polynom<double>(2,start.z, delta.z)); }