Here's a snippet that I use to draw server side boxes in DoD. I have it restricted to only draw on client 2, and only if developer 2 is on.
Put this at the bottom of SV_StudioSetupBones in animation.cpp in the game dll. The code above will have retrieved the bone information for you. DrawBox is a function that draws a box when sent an array of 8 vertices, and the r, g, b values of the colour to draw it with. It uses TE_LINES and is quite inefficient, I'll leave it to you to write a better one :) Also I only draw overy other hitbox - the ( i % 2 == 0 ) part. Looking over this, you could probably speed it up quite a bit. Some ideas would be sending a vector for angle, one for origin, one for mins and one for maxs instead of trying to send all 8. //Only draw hitboxes on entity with index 2 //and if developer is 2 or more if( developer && developer->value >= 2 && pEdict == g_engfuncs.pfnPEntityOfEntIndex(2) ) { mstudiobbox_t *pbbox; vec3_t tmp; vec3_t p[8]; int i,j; pbbox = (mstudiobbox_t *)((byte *)g_pstudiohdr + g_pstudiohdr->hitboxindex); for (i = 0; i < g_pstudiohdr->numhitboxes; i++) { //get the vector positions of the 8 corners of the bounding box for (j = 0; j < 8; j++) { tmp[0] = (j & 1) ? pbbox[i].bbmin[0] : pbbox[i].bbmax[0]; tmp[1] = (j & 2) ? pbbox[i].bbmin[1] : pbbox[i].bbmax[1]; tmp[2] = (j & 4) ? pbbox[i].bbmin[2] : pbbox[i].bbmax[2]; VectorTransform( tmp, (*g_pBoneTransform)[pbbox[i].bone], p[j] ); } //Only draw every other hitbox if( i % 2 == 0 ) DrawBox( p, 255, 0, 0 ); } } -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Dominik Tugend Sent: Friday, March 12, 2004 3:52 AM To: [EMAIL PROTECTED] Subject: Re: [hlcoders] ServerSide HitBox Drawing (won't work the way it should) Thank you for your fast answer. yes I already had the problem with oveflowing the client with TE_LINE messages but it only caused s.th. like lag and a warning message in console. Only drawing the important ones is a good idea, at the time the function is called form an console command and gets an index which box to draw. I hope I'll find where the correct angles are stored, cause like I said GET_BONE_POSITION( ENT(pPlayer->pev), iBone, origin, angles ); doesn't return the correct ones, only the positions are usefull. Is the origin form the middle of the hitbox or from one of its edges? (I asumed form the middle but If not that would explain a minor origin-height problem of my drawing function.) I plan to let the lines of a box last 7 seconds and draw every second a new box (form an selectable player and a selectable hitboxindex). So you can make an Screenshot and see how they moved on the server :) Here is an example screenshot of the function in work: http://home.arcor.de/matrixstorm/files/cstrike/msmod0001.jpg This Screenshot has been taken on our ClanServer and as you can see my crapy drawing function calcluates an incorrect hight. But the horizontal difference is not an mistake, this seems to be a problem since 1.6, I checked that by using the trace function and it reported that there is an head-hitbox on the server (as you can see on the screenshot too). (could be that when player starts to change his angle a message to the clients is sent and is not correctly updated when finished?) greetings PS: also i wonder why the shieldbox (number 20) is calculated even if you haven't a shield but that doesn't matter :) ----- Original Message ----- From: "Matt Boone" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Friday, March 12, 2004 10:40 AM Subject: RE: [hlcoders] ServerSide HitBox Drawing (won't work the way it should) > This is certainly a way to do it. However I think you'll find that > drawing that many TE boxes will overflow the client. One good way is > to only draw them on a single client, and only draw every second one. > That gives you a good general shape of the player and an indication if > your server hitboxes actually are where you think they are. > > -----Original Message----- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] On Behalf Of Dominik > Tugend > Sent: Friday, March 12, 2004 12:58 AM > To: [EMAIL PROTECTED] > Subject: [hlcoders] ServerSide HitBox Drawing (won't work the way it > should) > > [ see http://list.valvesoftware.com/mailman/private/hlcoders/2004-March/008469 .html ] > > > > _______________________________________________ > To unsubscribe, edit your list preferences, or view the list archives, please visit: > http://list.valvesoftware.com/mailman/listinfo/hlcoders > _______________________________________________ To unsubscribe, edit your list preferences, or view the list archives, please visit: http://list.valvesoftware.com/mailman/listinfo/hlcoders _______________________________________________ To unsubscribe, edit your list preferences, or view the list archives, please visit: http://list.valvesoftware.com/mailman/listinfo/hlcoders