Question: 3D Model Properties for CPMA HUDs

Hi,

I’m trying to create a custom HUD from this documentation: https://www.excessiveplus.net/documentation/client/huds

I so far I’ve used an existing config I found online and have been doing basic edits to it to try and shoehorn it into what I’m looking for. I’ve mostly been successful in that aside from one issue.

I’ve got the 3D player head model set as my health icon, as you would find it in VQ3. I’ve managed to match size and screen position for this as well. The problem comes in when the player takes damage. The 3D modeled head reacts when the player takes damage and becomes larger. In VQ3 this jump in size is up toward the center of the screen. For some reason, in my custom HUD the jump in size is directed downward to the bottom of the screen and as a result, can clip about a 3rd of the face off camera until it returns to normal size.

I think there must be an additional parameter that controls this that I’m just flat out missing documentation for. I initially suspected that the anchor flags mentioned in the doc I linked to might do something to compensate this, but regardless of the values I use… I only really succeed in moving the model around the screen. Regardless of where it shows up, it behaves the same.

StatusBar_HealthIcon
{
rect 285 420 60 60
draw3d
anchors 4
}

^ That’s what I’m working with for the head model. At this point I’m hoping someone that has better knowledge of how the stock HUD works, or more experience creating custom HUDs might be able to tell me where I’m messing this up.

Thanks.

so, finally get the idea to look at how the HUD was setup in Quake 3’s open-sourced files and inside cgame in cg_draw.c is the following…

================
CG_DrawHeadUsed for both the status bar and the scoreboard
================
void CG_DrawHead( float x, float y, float w, float h, int clientNum, vec3_t headAngles ) {
clipHandle_t cm;
clientInfo_t *ci;
float len;
vec3_t origin;
vec3_t mins, maxs;

ci = &cgs.clientinfo[ clientNum ];

if ( cg_draw3dIcons.integer ) {
cm = ci->headModel;
if ( !cm ) {
return;
}

// offset the origin y and z to center the head
trap_R_ModelBounds( cm, mins, maxs );

origin[2] = -0.5 * ( mins[2] + maxs[2] );
origin[1] = 0.5 * ( mins[1] + maxs[1] );

// calculate distance so the head nearly fills the box
// assume heads are taller than wide
len = 0.7 * ( maxs[2] - mins[2] );
origin[0] = len / 0.268; // len / tan( fov/2 )

// allow per-model tweaking
VectorAdd( origin, ci->headOffset, origin );

CG_Draw3DModel( x, y, w, h, ci->headModel, ci->headSkin, origin, headAngles );
} else if ( cg_drawIcons.integer ) {
CG_DrawPic( x, y, w, h, ci->modelIcon );
}

// if they are deferred, draw a cross out
if ( ci->deferred ) {
CG_DrawPic( x, y, w, h, cgs.media.deferShader );
}
}

My guess at this is I need an equivalent command for trap_R_ModelBounds. Without being able to define the space on screen that the head model is supposed to occupy I’m probably just spinning my wheels.