Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

Jackbenfu

Quake III's stairs

This topic is 5221 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi everybody, First of all, I''m french so... :D. So, I have a very important question to submit you. I''m currently programming a 3D engine (which you can see on www.jackbenfu.fr.st). My problem is about physics. I don''t know if you noticed but, climbing stairs in Q3 is smoothly than in most part of the other FPS games. It doesn''t make a jerked feeling. So, I''d like to understand how they implemented this physic on stairs... Beziers curves ? Dont know. So thanks very much to guys who will be able to help me. Jackbenfu

Share this post


Link to post
Share on other sites
Advertisement
1. do collision detection
2. if collide do collision (STEP_SIZE units higher)
3. if 2. !collide ->step
4. get movement vector
newpos = currentpos +speed*forward*frametime + STEP_SIZE;
movedir=newpos-currentpos;
movedir.norm()*frametime;

id do it that way


Share this post


Link to post
Share on other sites
For collision detection, use a copy of the map with less details. For instance, there''s no need to have each step of the stairs in the map, you can replace all of them by a simple slope as far as collision detection goes.

French version:
Pour détecter les collisions, utilise une version de ton niveau, mais avec moins de détails. Par exemple, tu n''as pas besoin d''avoir toutes les marches dans cette version : tu peux les remplacer par un plan incliné (en ce qui concerne les collisions).

Victor Nicollet, INT13 game programmer

Share this post


Link to post
Share on other sites
Euh j''ai pas besoin de traduction anglais -> français j''arrive quand même à comprendre...
En ce qui concerne le plan incliné dont tu me parles, ben c''est ce que j''ai fait (vois une des deux versions sur ma page perso, je ne sais plus laquelle c''est), mais ça donne pas trop. Je pense pas qu''ils aient fait comme ça chez Id :/

Share this post


Link to post
Share on other sites
except the pseudo code is riddled with errors and omissions. to take with a pinch of salt. however, the algo is sound.

Share this post


Link to post
Share on other sites
Why not get the source to the Quake 3 game dlls and see for your self how they do it?

Start with void CG_EntityEvent() in Code/CGame/cg_event.c

Share this post


Link to post
Share on other sites
The way I''ve implemented it is the player is represented by 2 bounding boxes: one for the head, and one for the feet.

Every frame, I trace from the head bounding box down to the foot bounding box. If the distance between the foot bounding box and the head bounding box is less than height, then you know you are on top of something. I then smootly begin to push the camera up, based on the amount left to push up, and of course, the frametime.

This ends up working *exactly* the same as in Quake3. It works because instead of using a giant bounding box, the ''head'' bounding box is allowed to just glide over objects such as stairs, and then it detects what is underneath you.

Here is the exact source. Note that CorrectPos is where the head position *should* be with respect to where the feet currently are. I''ve already tested for a collision, and closestFraction is the collision fraction when a ray is traced from the current foot position to where the head should be.


mPosition = mPosition + ((CorrectPos - mPosition) * Export.mpBSP->mBSPColInfo.closestFraction) * (8 * Export.mFPS.TimeFrac);

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!