I'm developing a simple "Geometry Wars" like game: 2D world and multiple enemy spaceships. The enemies should be able to pursue the player and avoid collisions between them at the same time. I've implemented a vector field algorithm based on this one. When two ships are too near between them, a force that slightly modifies the direction of the ship is created.

This works like a charm, the enemies pursue the player and no collision exits, but this happens sometimes:

enter image description here

This is because in one frame they "collide" and the path is modified, but, in the next frame they are not colliding and the path is not altered. This two states in loop cause that shaking.

Do you have any idea to solve this?

PS: if I didn't make myself clear, please ask me, english is not my first language


1 Answer 1


So yeah... I solved my problem... I was normalizing the vector from the enemies before adding it with the original direction, and this creates a step too big between "no collision" and "collision".


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .