Jump to content

Bounding Boxes...


Recommended Posts

I will be adding my bounding box fix that allows you to set the length and width seperately, I just have to remember what I did and to what part of the code. The reason I originally did it was due to oddly shaped npcs like dragons having crap bounding boxes. While my fix might have issues with MP, in SP it should be fine.

Link to comment

There are no classes for it. Pretty much all the code assumes AABBs are used so it's not going to be an easy replacement.

 

Btw, in terms of anything being modularised in jka, answer is always "it's not modularised" unless you're asking about large systems like rendering, or server code etc.

Link to comment

I read something about collisions in Rust (old devblog, but still might offer some insight on how things could work):

 

We’re not using hitboxes anymore. For those that don’t know what hitboxes are.. they’re this.

See those boxes? Well when you shoot a character in TF2, it traces a line forward from your eyes until it hits something. Characters in TF2 are made up of thousands of triangles, so it would be stupidly slow to test against all of those. So they stick some boxes where the head is, where the arms and legs are, where the torso is, and test against those instead. And this works great.

But it’s 2014 and putting hitboxes on stuff is hard work. So we’re using a skinned mesh collider. So check this naked guy out.

We already have a really low poly version of the player character thanks to LOD’ing.

So we can use that for collision!

It’s a skinned mesh, so each vertex is weighted to up to 4 bones. When the mesh is ‘shot’, we use the triangle ID to get the vertices, then we use the vertices to find the bone. The bones have multiple attributes. For example, the head and neck bones have multipliers, so that headshots to more damage (this is indicated by the red spheres in this picture).

This gives us a lot of benefits moving forward beyond just being more accurate to the render mesh. For example, if we were to add a helmet on the player we could make it so that getting shot in the face still killed them. This is something that’s not impossible with hitboxes, but it would be kind of clumsy.

Link to comment

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
×
×
  • Create New...