FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
Half Life Collision and Hit Detection

 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    The Ville.org Half-Life Gaming Community Forum Index -> Tech Corner
View previous topic :: View next topic  

Close enough to right?
Yes
50%
 50%  [ 3 ]
No
0%
 0%  [ 0 ]
what??
50%
 50%  [ 3 ]
Total Votes : 6

Author Message
My Personal Insanity
Registered User


Joined: 03 Mar 2002
Location: Salt Lake City GUILD: US-V
Posts: 2627

PostPosted: Fri Jan 16, 2004 3:27 am    Post subject: Half Life Collision and Hit Detection Reply with quote

This is, as near as I can glean from the rather sparse available
information, how things work. Please comment!

1. Collision Hulls (aka Clip hulls)

A collision hull is how the game determines if you are touching a wall or
another object (object being what I'll call an entity, with a model, that
moves about in all three dimensions). There are four hulls, the first of
which is generated at the time the map is compiled from the brushes in
the map itself. It doesn't follow the brushes exactly, though, but rather
extends out from each brush somewhat. (About one half of a player
size, but such varies depending on the complexity of the walls the mapper
lays down, as the compiler tries to smooth out the rectangular hulls to
decrease problems with getting stuck on complex surfaces).

The other three hulls are for objects, typically one hull is the size of a
standing player, the second hull is the size of a crouching player, and
the third is some small size for objects, like a small hull for grenades.
Because these hulls are simple boxes, they don't exactly match the
shape of the models, usually they are 'inside' the models by quite
a bit.

Finally, the hulls determine COLLISIONS only, i.e. "Has this object
smacked into a wall or another object?" They don't directly determine
if a weapon has hit or missed, which leads to...

2. Bounding Boxes (Aka Hitboxes aka MEDIC!)

Misleadingly enough named, bounding boxes are built around a
model to detect 'hits' from weapons. They are (again) simple rectangles,
no curves, that the model designer places around the visible model,
attempting to follow the actual shape of the model as best as possible.
Having many different hitboxes for each model allows the game to
adjust the effect of the hit to coincide with where it hit. (Thus the
difference between sniper headshots/body shots/leg shots in TFC, or
head/limb/body shots in DoD, etc).


Using these approximations of what the visual world is to calculate
collisions and hits leads occasionally to some odd circumstances:
With hulls, arms and legs might stick through walls, or a DoD player
standing on a prone player will appear to be floating above, since
the prone hull is the same as the crouching hull. With bounding boxes, a
shot just past the enemy's ear becomes a headshot, and you can
be hit "around corners" because even though very little or none of
your model is showing, just a bit of a hitbox poking around the corner
is enough to take damage (thus the imfamous "Toe Shot").

I've been trying to bring all this together in order to try to make sense
of a rant I've seen people speak ingame in DoD. It goes like this:

"Stupid DoD, using the same hull for crouching and prone, so those
@#%! KAR h00rs can headshot me even if I'm laying down behind
sandbags!!!!!!11111oneone"

As near as I can tell, this can't be: Your collision hull might be 3 feet
taller than you are, but since it doesn't care about weapon hits the enemy
can shoot at the top of it all day and all night; with your model's face in
the dirt, your hitboxes will be down there as well.

I think this perceived 'headshot 3 feet above my prone head' effect must
come from forgetting the dimensions of your model: If you're prone,
facing into a wall of sandbags, your legs are sticking out pretty
far, where they can take hits, especially if the shooter is not at the same
point on the Z axis as you are (since we all know snipers seem to like
to find high places to hide in). Since many DoD weapons do more than
100 damage with one unobstructed hit to the limbs (like the bolt action
rifles), what seems to be a cheating headshot is actually a toeshot.

Perhaps not much comfort to the person killed in that situation, but at
least it makes more sense.
Back to top
View user's profile Send private message Send e-mail Visit poster's website AIM Address Yahoo Messenger MSN Messenger
Potato-VS-
Registered User


Joined: 16 Jul 2002
Location: Ontario Canada
Posts: 1562

PostPosted: Fri Jan 16, 2004 6:26 am    Post subject: Reply with quote

Im currently programming collision detection in OpenGL - theres no easy solution and it seems that there are only about three ways to actually get collision detection to work in general and its the same for anything (be it opengl, direct x, glide, etc etc). From what Ive seen it appears that they have blended several different collision detecton methods and made something completly else then the usual plane/cyllinder collision detection (when you hit something such as a wall and you slide along it then thats a plane and when you hit something such as a cyllinder or prehaps even a rectangular object like a pillar, box, etc then you use cyllinders to deflect the player in another direction and stop them from traveling through the pollygone(s)). I actually think that they've done an excellent job at solving the progblem - no matter what any company as of yet has not actually figured out how to make a fast, stable and exact collision detection so I would say that valve has done an excellent job at it.
Back to top
View user's profile Send private message Send e-mail
Stevo
Ville Supporter
Ville Supporter


Joined: 08 Dec 2002
Location: Orange County Guild: TVR
Posts: 9514

PostPosted: Fri Jan 16, 2004 5:46 pm    Post subject: Reply with quote

Looks pretty accurate to me.
_________________

The Official TVR Website

Fopp
Song of the Week
Back to top
View user's profile Send private message Send e-mail Visit poster's website AIM Address Yahoo Messenger MSN Messenger
My Personal Insanity
Registered User


Joined: 03 Mar 2002
Location: Salt Lake City GUILD: US-V
Posts: 2627

PostPosted: Sat Jan 17, 2004 1:09 am    Post subject: Reply with quote

Potato-VS- wrote:
no matter what any company as of yet has not actually figured out how to make a fast, stable and exact collision detection so I would say that valve has done an excellent job at it.


I do think they've done pretty good, although I think some smarter
ways of rounding off the world-hull on complicated brushes might be
appropriate...

Of course, what I really hope for is HL2 to come out I wanna drive
that dune buggy.
Back to top
View user's profile Send private message Send e-mail Visit poster's website AIM Address Yahoo Messenger MSN Messenger
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    The Ville.org Half-Life Gaming Community Forum Index -> Tech Corner All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group