Sign in to follow this  

Preparing for physics

Recommended Posts

Hey guys. I have just finished specifications for a new game I want to write, but this time I want to include physics and ragdoll, although just as eyecandy. The game, a 3D sideway scroller really has no need for physics, but for certain things, like the player dying, I want a dramatic ragdoll effect. Or when a thing explodes I would like to see parts flying and bouncing on the floor, things that look good but have no real impact on the game. But since I have never done anything related to physics I am a bit unsure how to implement this, and I would therefore like to wait with that specific implementation. I also want to keep the complexity at a reasonable level. So my question is this, what do I need to keep in mind while writing the game to make is easier to implement physics in the end? Consider this a physics learning project.

Share this post

Link to post
Share on other sites
I dont think there is much to it, apart from the obvious. It is best to keep a separation between collision detection and the physics itself.

doing effects triggered by collisions are usually done via callbacks / message systems.

The collision systems are usually split into two.

- Broad phase (where the objects bound by simple volumes, are spacially 'sorted'). Using a bounding volume hierarchy, it builds a list of object pairs that can potentially collide.

- Narrow phase. This is responsible for detecting exact collisions between the pairs of objects to test.

- The collision objects are usually simple. Boxes, spheres, and terrains (list of edges in 2D).

plus some extra candy, like queries (ray intersection queries, objects inside an volume, ...).

For a simple effect system, I'd keep it simple and ignore the broad phase collision (and do a 'test against everything'). Your ragdoll / particles will collide against the terrain only, so there is no need for it).

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this