Hi again,

Im making a program in c++ using openGL (glut) but having a little trouble figuring out how i would increment along a certain path...

I have quite a few functions that require it like the one below, where i have the Point (contains x,y,z components) of the waypoint i need to head towards, and i have the angle to that waypoint from the current x,y,z position. Plus i can get the current position Point by just calling body->Get_Position(); if i need too.

But im just not sure how i would set the incrementation Point's x,y,z to send to the Set_Position function.

I would take a guess and say that if its walking and the angle rotates the view so its facing the waypoint, i would just increment the -z value of the current Point position by WALK_SPEED ? (WALK_SPEED is a #define)

but im not sure. Could anyone please give me some advice?

Thanks,

Code:void AI::Patrol() { body->set_Walking(true); body->set_Running(false); body->set_Still(false); Point increment; Point wp = Next_Waypoint(); float angle = Get_Position_Angle(wp); float range = Get_Range(wp); //How to get the incrementation in step? //increment.x = ? //increment.y = ? //increment.z = ? //WALK_SPEED ? //RUN_SPEED ? body->Set_Position(increment); body->Set_Yaw(angle); }

(i get the angle through this function, which i hope is correct)

Code:float AI::Get_Position_Angle(Point pos) { float angle; //Get the float angle between NPC position and parametre position angle = atan2(body->Get_Position().z-pos.z, body->Get_Position().x-pos.x)*(180 / PI); angle -= body->Get_Yaw(); return angle; }