Jump to content

Use Bullet primitives for hitbox detection


Recommended Posts

Today, Torque's way of doing hitboxes suck. I mean, look at this:


That's exactly the same way i use to do hitbox on the old Quake 1 engine and QuakeC. You have a big bounding box and you separate that into smaller pieces. Valve's way of doing hitboxes is much more efficient without wasting performance:


Where is most of the hitbox detection code in? Is it shoehorned into the player class in C++? Or is it spread over the physics abstractions? How are collision messages passed from client to server?

Link to comment
Share on other sites

If you're already planning on having ragdolls, then it makes the most sense IMHO to raycast for the physics bodies making up your ragdoll. I do this in PhysX, but bullet would be similar. I can't speak for stock Torque on the subject, however.

This also brings up an issue of whether you have physics bodies on your characters all the time, or only instantiate them when they die. I use the former method, but might be forced to implement more restrictive rules when I start having very high numbers of characters in the scene, such as only instantiating physics bodies on characters within a certain distance of the player, or in the camera view area if zoomed.

I'm sure it will take lots of trial and error to get it fully optimized, but so far at least I've found physx raycasts to be a quite inexpensive way to obtain not only a hit body, but the exact position, direction, surface normal and velocity of the projectile.

Link to comment
Share on other sites

  • 2 weeks later...

It's definitely possible, in physx i create kinematic actors from the bones exactly the same as you would for a ragdoll, that runs from the animations and when you do need a ragdoll just change the actors to dynamic. Would work perfectly with bullet too. Just make sure the projectile class is using physics for raycasting AND filter out the actual character controller for that raycast.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...