Author Topic: Bounding box and hitbox  (Read 493 times)

0 Members and 1 Guest are viewing this topic.

bitterman

  • Full Member
  • ***
  • Posts: 198
  • Karma: +8/-5
  • Doom Newbie
    • View Profile
Bounding box and hitbox
« on: July 05, 2015, 09:05:05 AM »
I have new model of player with two anims - idle and walk. Anims are played with script.

But I see there is a incorrect position for hitbox:

1. When it's idle hitbox is asymmetric (see pic.1).

2. After begin of walk cycle hitbox makes very little and then moving down (see pic. 2 - 3).

And I can't change size of bounding box for player model via "size", "mins" and "maxs" into player.def.

Is bbox for player hardcoded?

In walk anim "origin" bone is moving along +x if it's make sense.

Screenshots with g_showCollisionModels 1:



« Last Edit: July 05, 2015, 09:13:24 AM by bitterman »

bitterman

  • Full Member
  • ***
  • Posts: 198
  • Karma: +8/-5
  • Doom Newbie
    • View Profile
Re: Bounding box and hitbox
« Reply #1 on: July 05, 2015, 09:27:25 AM »
Ok, I found pm_bbox CVARS and they needs some tests.

How about hitbox?

http://www.kot-in-action.com/tutorials/blender2dp.html

Some troubles with "origin" bone orientation (axis) in Blender, hmm...
« Last Edit: July 05, 2015, 01:23:14 PM by bitterman »

bitterman

  • Full Member
  • ***
  • Posts: 198
  • Karma: +8/-5
  • Doom Newbie
    • View Profile
Re: Bounding box and hitbox
« Reply #2 on: July 13, 2015, 01:24:07 AM »
The blue box around player model (g_showcollisionModels 1) is not hitbox (my mistake).

It's unknown (for me) 'DebugBounds' and I still don't understrand how it works (see line 1633):

Code: [Select]
1613 ============
1614 idClip::DrawClipModels
1615 ============
1616 */
1617 void idClip::DrawClipModels(const idVec3 &eye, const float radius, const idEntity *passEntity){
1618       int i, num;
1619       idBounds bounds;
1620       idClipModel *clipModelList[MAX_GENTITIES];
1621       idClipModel *clipModel;
1622
1623       bounds = idBounds( eye ).Expand( radius );
1624
1625       num = idClip::ClipModelsTouchingBounds( bounds, -1, clipModelList, MAX_GENTITIES );
1626
1627 for ( i = 0; i < num; i++ ) {
1628        clipModel = clipModelList[i];
1629        if ( clipModel->GetEntity() == passEntity ) {
1630        continue;
1631        }
1632        if ( clipModel->renderModelHandle != -1 ) {
1633        gameRenderWorld->DebugBounds( colorCyan, clipModel->GetAbsBounds() );
1634        } else {
1635        collisionModelManager->DrawModel( clipModel->Handle(), clipModel->GetOrigin(),     clipModel->GetAxis(), eye, radius );
1636        }
1637    }
1638 }

Code: [Select]
1869 ====================
1870 idRenderWorldLocal::DebugBounds
1871 ====================
1872 */
1873 void idRenderWorldLocal::DebugBounds( const idVec4 &color, const idBounds &bounds, const idVec3 &org, const int lifetime ) {
1874       int i;
1875       idVec3 v[8];
1876
1877       if ( bounds.IsCleared() ) {
1878       return;
1879       }
1880
1881       for ( i = 0; i < 8; i++ ) {
1882       v[i][0] = org[0] + bounds[(i^(i>>1))&1][0];
1883       v[i][1] = org[1] + bounds[(i>>1)&1][1];
1884       v[i][2] = org[2] + bounds[(i>>2)&1][2];
1885       }
1886       for ( i = 0; i < 4; i++ ) {
1887       DebugLine( color, v[i], v[(i+1)&3], lifetime );
1888       DebugLine( color, v[4+i], v[4+((i+1)&3)], lifetime );
1889       DebugLine( color, v[i], v[4+i], lifetime );
1890       }
1891 }

This box is moving with 'origin' bone and change size.

Now I believe that (unlike other models) player's model does not have to moving bone 'origin' for moves animations (walk, run etc).

Red box is still bounding box and it's well documented.

D3 has also many others colored boxes (green, yellow etc) and they are poor or not documented. Need more information.
« Last Edit: July 13, 2015, 05:35:34 AM by bitterman »

bitterman

  • Full Member
  • ***
  • Posts: 198
  • Karma: +8/-5
  • Doom Newbie
    • View Profile
Re: Bounding box and hitbox
« Reply #3 on: July 17, 2015, 12:34:11 PM »
« Last Edit: July 17, 2015, 12:40:05 PM by bitterman »