Talk:NPC Hull

From Valve Developer Community
Jump to: navigation, search

Dimensional Data

This is more confusing than I expected!

  • From ai_hull.cpp I got this vector data, which i have tried to interpret into box dimensions. The first pair of coords seem likely to describe the collision hull, but the second set of coords ... ? :
Ground Nav              Hull-1 vectors                  Hull-2 vectors                  Hull-1 dimensions    Hull-2 dimensions
*  Tiny_Hull		(-12,-12,  0),	(12, 12,  24),	(-12,-12,  0),	(12, 12,  24) 	= 24 x 24 x 24	 ==   24 x 24 x 24 
*  Human_Hull		(-13,-13,  0),	(13, 13,  72),	( -8, -8,  0),	( 8,  8,  72) 	= 26 x 26 x 72	 &/   16 x 16 x 72 
*  Wide_Human_Hull	(-15,-15,  0),	(15, 15,  72),	(-10,-10,  0),	(10, 10,  72)  	= 30 x 30 x 72	 &/   20 x 20 x 72 
*  Medium_Hull		(-16,-16,  0),	(16, 16,  64),	( -8, -8,  0),	( 8,  8,  64) 	= 32 x 32 x 64	 &/   16 x 16 x 64
*  Medium_Tall_Hull	(-18,-18,  0),	(18, 18, 100),	(-12,-12,  0),	(12, 12, 100) 	= 36 x 36 x 100	 &/   24 x 24 x 100
*  Wide_Short_Hull	(-35,-35,  0),	(35, 35,  32),	(-20,-20,  0),	(20, 20,  32)   = 70 x 70 x 32	 &/   40 x 40 x 32
*  Large_Hull		(-40,-40,  0),	(40, 40, 100),	(-40,-40,  0),	(40, 40, 100) 	= 80 x 80 x 100	 ==   80 x 80 x 100
Air Nav
*  Tiny_Centered_Hull	( -8, -8, -4),	( 8,  8,   4),	( -8, -8, -4),	( 8,  8,   4) 	= 16 x 16 x  8	 ==   16 x 16 x  8 
*  Small_Centered_Hull	(-20,-20,-20),	(20, 20,  20),	(-12,-12,-12),	(12, 12,  12) 	= 40 x 40 x 40	 &/   24 x 24 x 24 
*  Large_Centered_Hull	(-38,-38,-38),	(38, 38,  38),	(-30,-30,-30),	(30, 30,  30) 	= 76 x 76 x 76	 &/   60 x 60 x 60 

note: all NPC Hulls have a square footprint with the origin at the centre = NPC's centre of horizontal rotation. (why not use a cylinder?)
note: Ground nav NPC Hulls tower above the origin, whereas Air-nav (_Centered_Hull) hull is half above and half below its origin.
note: the mysterious Hull-2 always fits inside Hull-1, and shares the same axes of symmetry as Hull-1.
  • Notice also that the min pathway for human_hull is 30 wide by 73 high, so there's some factor other than hull size involved. Even more bizarrely, npc_combine.cpp uses the human_hull, but it's min pathway is wider than other humans tested; 32 wide by 73 high. I'm thinking this is not a simple add 1 unit for friction factor ... ? --Beeswax 10:53, 7 Mar 2008 (PST)
I'm using the beta SDK code, and that enum now looks like this:
ai_hull_t  Human_Hull		(bits_HUMAN_HULL,		"HUMAN_HULL",		Vector(-13,-13,   0),	Vector(13, 13, 72),		Vector(-8,-8,   0),		Vector( 8,  8, 72) );
ai_hull_t  Small_Centered_Hull	(bits_SMALL_CENTERED_HULL,	"SMALL_CENTERED_HULL",	Vector(-20,-20, -20),	Vector(20, 20, 20),		Vector(-12,-12,-12),	Vector(12, 12, 12) );
ai_hull_t  Wide_Human_Hull	(bits_WIDE_HUMAN_HULL,		"WIDE_HUMAN_HULL",	Vector(-15,-15,   0),	Vector(15, 15, 72),		Vector(-10,-10, 0),		Vector(10, 10, 72) );
ai_hull_t  Tiny_Hull		(bits_TINY_HULL,		"TINY_HULL",		Vector(-12,-12,   0),	Vector(12, 12, 24),		Vector(-12,-12, 0),	    Vector(12, 12, 24) );
ai_hull_t  Wide_Short_Hull	(bits_WIDE_SHORT_HULL,		"WIDE_SHORT_HULL",	Vector(-35,-35,   0),	Vector(35, 35, 32),		Vector(-20,-20, 0),	    Vector(20, 20, 32) );
ai_hull_t  Medium_Hull		(bits_MEDIUM_HULL,		"MEDIUM_HULL",		Vector(-16,-16,   0),	Vector(16, 16, 64),		Vector(-8,-8, 0),	    Vector(8, 8, 64) );
ai_hull_t  Tiny_Centered_Hull	(bits_TINY_CENTERED_HULL,	"TINY_CENTERED_HULL",	Vector(-8,-8,    -4),	Vector(8, 8,  4),		Vector(-8,-8, -4),		Vector( 8, 8, 4) );
ai_hull_t  Large_Hull		(bits_LARGE_HULL,		"LARGE_HULL",		Vector(-40,-40,   0),	Vector(40, 40, 100),	Vector(-40,-40, 0),		Vector(40, 40, 100) );
ai_hull_t  Large_Centered_Hull	(bits_LARGE_CENTERED_HULL,	"LARGE_CENTERED_HULL",	Vector(-38,-38, -38),	Vector(38, 38, 38),		Vector(-30,-30,-30),	Vector(30, 30, 30) );
ai_hull_t  Medium_Tall_Hull	(bits_MEDIUM_TALL_HULL,		"MEDIUM_TALL_HULL",	Vector(-18,-18,   0),	Vector(18, 18, 100),	Vector(-12,-12, 0),	    Vector(12, 12, 100) );
Which is a little easier to understand. :-) --TomEdwards 11:58, 7 Mar 2008 (PST)
I should elaborate: the four co-ordinate values in that code define the four points of the bounding box. --TomEdwards 12:04, 7 Mar 2008 (PST)
I'm using the same source but I edited the quoted text to emphasise relevant information . At first I thought as you say, 4 points = 4 corners, but a right-angled box has 8 corners and only needs 2 coordinates/vectors to define it. Notice that for Large_Hull, Tiny_Hull and Tiny_Centered_Hull the second pair of coordinates are identical to the first pair ... they must therefore represent 2 boxes co-occupying the same space. --Beeswax 13:09, 7 Mar 2008 (PST)
  • ModelViewer shows 2 'bounding' boxes, labelled Movement and Seq.Boxes. Neither consistently correspond to the ai_hull data listed here ... Seq Boxes appears to display the RenderBox for a particular animation sequence. --Beeswax 13:28, 7 Mar 2008 (PST)