Advertisement

Playing on the playground

Started by August 22, 2003 06:34 AM
2 comments, last by VanKurt 21 years, 6 months ago
This screenshot shows an ugly little playground model, which I have created for my game: “So what?” you might ask yourself now, but here’s the reason for this post: At the moment my game consists more or less of graphics and sound only. Because of this you can’t really play it because things like collisions etc. are missing. So now it’s time for me to implant that. (In my opinion this is even a difficultier task than doing the graphics stuff….) What I know is that you need collision detection (to see if the player collides with one of the objects). Then you need collision response to make the player react realistically (e.g. Walk up stair, slide along a wall etc.). The first part seems not too difficult. I’ve already implanted a bounding box check and a tri-tri check could be done using an API like ColDet (right?). But then follows the difficult part: Collision response. I have not the slightest idea how to handle that. Let’s say I found out that the BBox of the player collides with some tri of my playground. How do I find out if the player should stop, slide along the tri (like a wall) or move up/down (like stairs or a ramp) ??? That’s really a miracle to me… The result of all that should be that the player is able to walk around, slide and jump on this playground like in “real” games (Quake, HL etc.)… I’m glad of ANY suggestions, ideas, explainations, comments, links, samples, tutorials etc. !!! Thanks a lot in advance. Bobo
It depends how realistic you want your simulation to be. Are you looking for "arcade" type physics, such as what Quake 3, Half-Life, etc. use, or realistic physics? If you''re looking for the latter, you might want to check out two libraries.

Open Dynamics Engine
http://opende.sourceforge.net/

Tokamak
http://www.tokamakphysics.com/

Both provide a way to implement collision response.

As for the first option... there are many sources of reference for this, not the least being the Quake 3 VM source code. The basic approach to this is to go through several iterations of collision detection and response per physics frame:

1) Trace a line from the entity''s current position to where they would be at a certain time, applying gravity and such.
2) If a collision occurs, clip the movement and offset the vector to slide along the plane of collision.
3) Rinse and repeat as necessary.
Advertisement
or commonly knowed as swept volumes collisions (google).

check this one out. I think it would work well for your problem, it handles the case where a player walks on stairs automatically.

http://www.fluidstudios.com/publications.html

"collision detection for games using ellipsoids."

It''s not exactly 100% rigid body dynamics, but suited to platform games and FPS games.

Everything is better with Metal.

Ahh, that sounds good. Thanks-a-lot!!! :-)

This topic is closed to new replies.

Advertisement