AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Determine a model size (https://forums.alliedmods.net/showthread.php?t=333885)

Shadows Adi 08-13-2021 17:40

Determine a model size
 
Hello,
How could I determine the size of a model. I need to create an entity and set it's size as big as the model.
So far I found this stock:
PHP Code:

stock mdlsize(filename[],Float:vec[3]){
    new 
file fopen(filename,"rb")
    
    if (!
file)
    
server_print("CANT OPEN %s"filename)
    
    
fseek(file,160,SEEK_SET)
    new 
bboff
    fread
(file,bboff,BLOCK_INT)
    
fseek(file,bboff+8,SEEK_SET)
    new 
Float:size[6]
    
fread_blocks(file,_:size,6,BLOCK_INT)
    
fclose(file)
    
vec[0]=size[3]-size[0]
    
vec[1]=size[4]-size[1]
    
vec[2]=size[5]-size[2]


As results, I get the mins + maxs vectors but it doesn't work.

HamletEagle 08-14-2021 02:29

Re: Determine a model size
 
You can't (in most cases). Set the size by trial and error.

Shadows Adi 08-14-2021 11:46

Re: Determine a model size
 
How could I get the model size from the .qc file or smd's? Should I use milkshape 3d?

hitD 08-14-2021 16:31

Re: Determine a model size
 
You can define box size in your qc file. Though I never tried it out. You can check it here
https://the303.org/tutorials/gold_qc.html
The qc command is $bbox and you can retrieve the values with this function https://www.amxmodx.org/api/fakemeta...delBoundingBox
I hope that's what you want to achieve

Shadows Adi 08-14-2021 17:57

Re: Determine a model size
 
Thank you, but it didn't worked, it prints only 0.0000 at any vector. Found this function: GetModelCollisionBox() which seems to be deleted from 1.9.0+.
Finally, found out that if I set the $flags 512 in .qc file, it will bound the model's hitboxes automatically. Or this is what I found after some debugging.

Post: https://forums.alliedmods.net/showpo...64&postcount=2

Celena Luna 08-15-2021 22:39

Re: Determine a model size
 
Quote:

Originally Posted by Shadows Adi (Post 2755237)
How could I get the model size from the .qc file or smd's? Should I use milkshape 3d?

in MS3D, after you load the mesh of the model, you can check it min/max via Tools>Show Model Statics or Tools>Model Infomation v1.7
There is min/max data there

iirc, there are 2 coordinate position was swapped (so the order shown there is not x y z)

Shadows Adi 08-16-2021 14:41

Re: Determine a model size
 
Quote:

Originally Posted by Celena Luna (Post 2755324)
in MS3D, after you load the mesh of the model, you can check it min/max via Tools>Show Model Statics or Tools>Model Infomation v1.7
There is min/max data there

iirc, there are 2 coordinate position was swapped (so the order shown there is not x y z)

Yeap, got the bounding sizes, but it bounds them weird, so I will remain at the fix found .


All times are GMT -4. The time now is 02:34.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.