Hopefully this hasn’t been asked before on this sub, but I was wondering why so many games struggle with good hit boxes? Why are they even “boxes” in the first place? I would assume they would just be carbon copies of the character model instead of having individual boxes that stretch out over the characters body.
In: Technology
Former game developer here,
What you’re asking to do is actually very complicated. Let’s presume you’re shooting at a cube. A cube is 6 planes, and they each have a normal vector indicating which side is top and bottom, so all you have to do is determine if your bullet is on the bottom of all the planes. The only way that can happen is if the bullet is inside the cube.
Simple.
Now do that for a 400,000 polygon enemy model. Go ahead. I’ll wait, because it’ll take a while. Also, this test doesn’t work if the model is concave, because you’ll be on the outside of some polygons while still being inside the model.
But also, the enemy isn’t always 400k polygons. The further away it is, the fewer polygons it is. The lower resolution you have your settings, the fewer polygons. Hell, at it’s furthest distance, it may be a 2D billboard.
So if you’re playing with friends and shoot at the same thing from different distances and configurations, are you shooting at the same thing? Is it fair?
But also you want the game to run. A hit box simplifies the problem for performance. It’s easier to check a box than 400k polygons. And these are actually stored in hierarchies of better and better fits. I can surround a whole tank in a box to determine if I have to bother to see whether you clipped it in the cannon barrel or not.
Latest Answers