I am creating a space ship battle game and I am working on the AI of the enemy ships.
The ships can rotate with a Yaw, Pitch and Roll and can generate force in the direction of the heading of the ship. It means that in order for the ship to generate a force in an arbitrary direction it need to rotate its head to that direction first.
Now I am trying to implement some steering behaviours, such as seek.
I have the book programming Game AI by Example in there the 2D seek is as such:
Vector V = (TargetPos-Vehicle->Pos).Normalize()*Vehicle->MaxSpeed;
I also create a force to movement translator, which means that if the steer gives a desired force to the space ship, the translator will translate this into rotation and forward force.
So if the desired force is in the opposite direction of the head of the ship, the ship will only rotate without generating forward force.
If I implement the above seek behavior, the problem is that the ship may constantly swing and rotate from left to right when I do pursuit which use seek, because the seek gives a force the is far from the heading of the ship and from the line connecting the positions of the two ships.
So what I did instead:
Vector V = (TargetPos-Vehicle->Pos).Normalize*Vehicle->MaxSpeed;
I dont get the swinging and rotation jittering of the ship, and it chase the target quite ok, but then the enemy ship wont chase the target optimally?
So, do you have any suggestions how to implement seek?
Steering behaviour seek with constraints
No replies to this topic
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users