# Object/collision avoidance in 2-dimensions

• 06-14-2004
charbach007
Object/collision avoidance in 2-dimensions
Hello. Is there any way to do simple collision avoidance for a system where one object is being chased by two others? The "prey" should be avoiding the "two predators". Two dimensional would be preferred. I can't seem to get anything to work correctly :confused: . Thank you! Here's the list of variables I'm using...(for reference)
Predator 1's x-coord: alpha
Predator 1's y-coord: beta
Predator 1's angle (from x-axis, angle>=0): theta
Predator 2's x-coord: iota
Predator 2's y-coord: kappa
Predator 2's angle (from x-axis, angle>=0): delta
Prey's x-coord: epsilon
Prey's y-coord: zeta
Prey's angle (from x-axis, angle>=0): eta
• 06-14-2004
The simple answer is yes. A somewhat longer answer is it depends on what you call simple. Having worked on a collision detection system a while back, it's not as simple as it seems, depending on borders, etc., though I wouldn't doubt that game programmers have stock algorithms written for this type of thing, as it's the basis for many games. You might get a more sophisticated answer on the gaming board.
• 06-14-2004
charbach007
thanks, I'll try there
• 06-15-2004
Davros
Try handling the direction and speed (velocity) of your objects as vectors. That way you can work out the distance between objects easily, you can calculate new positions simply by adding the velocity vector to the position at each time step. Furthermore, you can reverse the direction of your prey object when a preditor comes too close simply be reversing the sign of its velocity. Alternatively, your objects can have a 'thrust' vector which acts to change the velocity (accelaration) for a more realistic effect.
• 06-15-2004
Salem