Raised This Month: $51 Target: $400
 12% 

Determine a model size


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Shadows Adi
AlliedModders Donor
Join Date: Aug 2019
Location: Romania
Old 08-13-2021 , 17:40   Determine a model size
Reply With Quote #1

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.
__________________


Accepting Paid Requests, contact PM.

MVP Of The Round View project on GITHUB / AlliedModders
CSGO REMAKE ~ CSGO MOD [STABLE + SOURCE CODE]

Last edited by Shadows Adi; 08-13-2021 at 18:15.
Shadows Adi is offline
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 08-14-2021 , 02:29   Re: Determine a model size
Reply With Quote #2

You can't (in most cases). Set the size by trial and error.
__________________
HamletEagle is offline
Shadows Adi
AlliedModders Donor
Join Date: Aug 2019
Location: Romania
Old 08-14-2021 , 11:46   Re: Determine a model size
Reply With Quote #3

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


Accepting Paid Requests, contact PM.

MVP Of The Round View project on GITHUB / AlliedModders
CSGO REMAKE ~ CSGO MOD [STABLE + SOURCE CODE]
Shadows Adi is offline
hitD
Junior Member
Join Date: May 2017
Location: Lithuania
Old 08-14-2021 , 16:31   Re: Determine a model size
Reply With Quote #4

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
hitD is offline
Shadows Adi
AlliedModders Donor
Join Date: Aug 2019
Location: Romania
Old 08-14-2021 , 17:57   Re: Determine a model size
Reply With Quote #5

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
__________________


Accepting Paid Requests, contact PM.

MVP Of The Round View project on GITHUB / AlliedModders
CSGO REMAKE ~ CSGO MOD [STABLE + SOURCE CODE]
Shadows Adi is offline
Celena Luna
Veteran Member
Join Date: Aug 2013
Location: Nagazora
Old 08-15-2021 , 22:39   Re: Determine a model size
Reply With Quote #6

Quote:
Originally Posted by Shadows Adi View Post
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)
__________________
My plugin:

Last edited by Celena Luna; 08-15-2021 at 22:39.
Celena Luna is offline
Shadows Adi
AlliedModders Donor
Join Date: Aug 2019
Location: Romania
Old 08-16-2021 , 14:41   Re: Determine a model size
Reply With Quote #7

Quote:
Originally Posted by Celena Luna View Post
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 .
__________________


Accepting Paid Requests, contact PM.

MVP Of The Round View project on GITHUB / AlliedModders
CSGO REMAKE ~ CSGO MOD [STABLE + SOURCE CODE]
Shadows Adi is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 09:29.


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