Ok sorry about the multiple post, here is the picture of the walls and the path that the vehicles have to follow while avoid each other so far i have
seek
vector<float> BRAINENG::Seek(vector<float> point,vector<float> currentPosition)
{
float maxspeed=1;
vector<float> Velocity;
Velocity.push_back(1);
Velocity.push_back(1);
vector<float> normalvec=Normalize(point,currentPosition);
vector<float> subtract=VectorSubtract(currentPosition,normalvec);
subtract[0]=subtract[0]*maxspeed;
subtract[1]=subtract[1]*maxspeed;
vector<float> point2=VectorSubtract(subtract,Velocity);
return subtract;
}
I currently programming the path for one vehicle to go from point a to point b in a vector list.
I think it might be a combination of seek, path follow and avoid methods but, I not sure how to program avoid by avoiding the current position relative to the walls, and the current position relative to obstacles in the path of the player.
The left most part of the image is the starting point of the vector list. While the right side of the list is the end point of the list.
this is sudo code of the object in question
private:
vector<int> targetPosition;
...
if (Abs(length to next object)< 5)//if the length of the object is close then look goto next position from current position.
{
targetPosition = vector list next points
++currentPathPoint;
return Seek(vector current pos, vector curentpos,volocity,speed);
}
else
{
return Seek(vector targetPosition, vector currentPosition, Velocity,speed);
}
path follow of one object on the given path.
I need an example of how to avoid the walls(note: walls are not drawn)., and the obsticles, thus getting the vehicle to the end of the path.
Developer of Space Chips, pianobasic, zipzapzoom, and vet pinball apps.
Developed the tiled map engine seen on the showcase.
Veterian for the military.