Posted by: Beamish
Date posted: Mar 08 2005 User Rating: N/A | Number of views: 4111 Number of comments: 1 | Description: Adds a console command to output the players bounding box mins & maxs to the console, and also draw's the bounding box in the world. |
Not so much of a Tutorial, more of a this might be useful to someone....
I have been playing with player bounding boxes recently, and have been getting all kinds of strange things happen, so I needed a way to check the boundingbox settings.
I added a console command "beamish_show_bbox", which outputs the min & max vectors to the console, and also draws the players bounding box in the world for a period of 5 secs.
Here is the code:
Add this to: src\dlls\client.cpp (around line 294 should be good, just before this : CON_COMMAND_F( cast_hull, "Tests hull collision detection", FCVAR_CHEAT )
CON_COMMAND_F( beamish_show_bbox, "Shows player's bounding box", FCVAR_CHEAT ) { CBasePlayer *pPlayer = UTIL_GetCommandClient(); Vector orig = pPlayer->GetAbsOrigin(); Vector mins = pPlayer->GetPlayerMins(); Vector maxs = pPlayer->GetPlayerMaxs(); DevMsg( "Mins: x:%.2f, y:%.2f, z:%.2f\n", mins.x, mins.y, mins.z); DevMsg( "Maxs: x:%.2f, y:%.2f, z:%.2f\n", maxs.x, maxs.y, maxs.z); NDebugOverlay::Box( orig, mins, maxs, 255, 0, 0, 255, 15.0); }
Cheers,
Beamish. |
|