Jump to content

Proper locational damage with getDamageLocation?


Recommended Posts

The built-in T3D function Player::getDamageLocation() is responsible for detecting the vertical position of the hit based on the player model bounding box and deciding if it was a head, body or leg shot. However, i have a few questions about the feature:


  • How does it handle near-misses? Does it check the bounding box and then the model? What if i hit a bullet next to ear, but miss it by inches? Will it still hit, like old 2D games and square bounding boxes?
  • What about crouching and proning? How does it handle it?
  • Is there a more modern way of detecting hits in T3D? Like, having several different physics colliders attached to the player, so we can detect a proper arm/leg shot, head, throat, lower body, upper body, etc. In Unity, we can parent physics colliders to bones, and then, bone-based damage.
  • Can we get the nearest bone name during a raycast? The bone acting on that vertex/face?

Link to comment
Share on other sites

The damage based on bounding box location works, but it is very primitive, so no way to tell if the ear was hit, not even the head can be measured very accurate. Crouching just reduces the size of the bounding box thing, there are values for it in the player datablock "crouching bounding box" or something. Prone will pretty much break the system, since it is built for vertical standing players.

There is a resource in the garagegames resources section where someone presents code for hitboxes, so you can have hitboxes on your player and the code will tell what has been hit, would be cool if someone could get it to work, since I want that also.

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...