How do collision algorithms work (like Angry birds)?

In summary, the conversation was about writing an algorithm for collisions between multiple objects, specifically in the context of the game Angry Birds and its use of the Chipmunk physics engine. While the exact details of the algorithm were not discussed, it was suggested that it would involve the laws of physics and equations related to ballistic projectiles and work/energy. There were also different approaches mentioned for collision detection, such as waiting for objects to occupy the same space and using previous velocities and positions to calculate the reaction.
  • #1
xael821
1
0
Hi,
Does anyone know how to write an algorithm for collisions between many objects? An example like this would be the game Angry Birds which uses the Chipmunk physics engine? Chipmunk is based of "contact persistence algorithm" but I can't find out really what that is... any ideas on how to program it?
 
Physics news on Phys.org
  • #2
Well, I can't say too much about it, but I can give some ideas. It probably involves the laws of physics and the equations that result from them. Things like ballistic projectiles typically covered in a high school physics class and work/energy. You could probably make a very basic physics engine based only on physics learned in high school, but it would not be optimal and particularly realistic, being based on assumptions that there is no air resistance, averages, and other reasonable assumptions that work in theory but produce small errors in real life.
 
  • #3
I've seen several approaches for collision detection. The simplest ones seem to wait until portions of two (or more) objects occupy the same space. Then the previous velocities and positions of the objects (each integration step saves one set of values for this purpose), are used to calculate the reaction to the collision. This can get complicated if more than two objects can collide at the same time.
 

FAQ: How do collision algorithms work (like Angry birds)?

How do collision algorithms work?

Collision algorithms use mathematical equations and algorithms to determine when two objects in a game have collided. This is typically done by comparing the size, shape, and position of the objects to determine if they are overlapping.

What factors are considered in collision algorithms?

Collision algorithms consider the shape and size of objects, their position and movement, and the environment in which the collision is taking place. They also take into account any properties of the objects that may affect their collision, such as weight or elasticity.

How do collision algorithms handle complex shapes?

Collision algorithms can handle complex shapes by breaking them down into smaller, simpler shapes. These smaller shapes are then checked for collision individually, and the overall result is determined based on the collision of the smaller shapes.

How do collision algorithms determine the outcome of a collision?

The outcome of a collision is determined by the properties of the objects involved, such as their weight and elasticity. The algorithm will also take into account the angle and speed at which the objects collided, and use this information to calculate the resulting movement and position of the objects after the collision.

Can collision algorithms be optimized for better performance?

Yes, collision algorithms can be optimized for better performance by using more efficient mathematical equations and algorithms, as well as implementing techniques such as spatial partitioning to reduce the number of collision checks that need to be performed.

Back
Top