This is an extension I made to emulate the effects of this thread
, because I didn't want to go and recompile all of my models.
This extension provides natives with the ability to modify the hitboxes of a model without recompilation.
You can modify a hitboxes:
- You can modify a hitboxes:
- Min Point
- Max Point
- And you can also get all of this info from a hitbox
- You can change the number of hitboxes in the hitboxset of the model.
- You can not change this beyond the amount of hitboxes the model originally had, however you can make it less than or even negative values so you can skip all the calculations for it.
- Use GetNumHitboxes first if you aren't removing them altogether so you can get the max number you can set without crashing.
- Print debug info about a models hitboxes to server console
- Print debug info about a models bones to server console
- Print a list of valid bones/bone names for use as a hitbox bone
- Get a bones index by its name
I also made an enum struct in the include if you want to define a bunch of hitboxes to be reused on models easily and cleanly.
A test plugin is in the sourcecode as well if you want to check out how to use the different features.
- HitboxInfo: Print all the hitboxes to server console
- BoneInfo: Print all the bones to server console
- SetHitbox: Set the properties at a hitbox index
- GetHitbox: Get the properties at a hitbox index
- SetNumHitboxes: Set the number of hitboxes for a model
- GetNumHitboxes: Get the number of hitboxes for a model
- FindBone: Find a bone's index in a model by name
- FindValidBones: Print a list of the bones in a model which can have a hitbox attached
Due to the many differences in code between csgo and previous games, this extension was only made for CS:GO, but most of the core code should work if you want to edit it for another game, mostly stuff like removing the capsule hitbox code, feel free to fork it for other games.
This is also the reason for including the modified csgo code, much of it was updated past the point where it would be compatible with the old mirrors, so It took a lot of trial and error to merge old and new together into a functional frankenstein.
For an unknown reason this extension will crash windows servers when they try to get the StudioHDR of a model, and so this extension is linux only unless someone is able to figure out a fix for that, I won't be actively trying to fix it as I don't own any windows servers.
The extension now works for windows thanks to help from Peace-Maker, thanks.
Note: This extension is now included in the latest version of ZR, if you have the latest version, this is already done, just add the extension.
If you are using the ZR plugin, and want to remove human hitboxes for a performance boost, simply alter the zr/models.inc file to include the extension and edit the ModelsPrecache function to be:
Get the extension and include on GitHub
* Precaches all models.
// Loop through all models, build full path and cache them.
for (new model = 0; model < ModelCount; model++)
ModelsGetFullPath(model, file, sizeof(file));
int modelIndex = PrecacheModel(file);
if((modelIndex != 0) && (ModelData[model][Model_Team] == ModelTeam_Humans))