AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   entity_set_size() Help / Model Solidification (https://forums.alliedmods.net/showthread.php?t=51912)

mysticssjgoku4 02-26-2007 11:49

entity_set_size() Help / Model Solidification
 
Hmm I've been having issues with figuring out how the entity_set_size function works, and why there are two sets of coordinates.

Well...I just don't know what each x,y,z is used for so I ripped the function out of the source....and I'm still stuck...

Now...I just don't understand WHY there are two sets of coords, and HOW they work...I've played around with them for at least a few hours and I'm still baffled.

Now I have a theory....Tell me if I'm right or wrong...
Is one set of origins for the size, then the other set for the angles its placed in at?
-------

Second issue...I even PM'd Bailopan to try and figure this out, but for some reason, when you set a bounding box with this function, it keep the location the same always. The angle never changed and I'm stuck as to why it never changes...

Here's the code I was using:
Code:
    new Float:angles[3]     angles[0] = 0.0     angles[1] = float(angle)     angles[2] = 0.0     new Float:mins[3] = {-75.0 , -60.0 , -32.0}     new Float:maxs[3] = {60.0 , 60.0 , 32.0}     entity_set_size(storecar,mins,maxs)         entity_set_vector(storecar,EV_VEC_angles,angles)

The angle is set on the model of the ent, but not the bounding box. Do you think my theory comes into play?
-------


Any help would be appreciated.

Thanks.

Code:

static cell AMX_NATIVE_CALL entity_set_size(AMX *amx, cell *params)
{
        int iEnt = params[1];

        CHECK_ENTITY_SIMPLE(iEnt);
       
        edict_t *pEnt = INDEXENT2(iEnt);

        cell *cMin = MF_GetAmxAddr(amx, params[2]);
        REAL x1 = amx_ctof(cMin[0]);
        REAL y1 = amx_ctof(cMin[1]);
        REAL z1 = amx_ctof(cMin[2]);
        Vector vMin = Vector(x1, y1, z1);

        cell *cMax = MF_GetAmxAddr(amx, params[3]);
        REAL x2 = amx_ctof(cMax[0]);
        REAL y2 = amx_ctof(cMax[1]);
        REAL z2 = amx_ctof(cMax[2]);
        Vector vMax = Vector(x2, y2, z2);

        UTIL_SetSize(pEnt, vMin, vMax);

        return 1;
}


Zenith77 02-26-2007 11:59

Re: entity_set_size() Help / Model Solidification
 
min/max are offset vectors from the entity's current origin, I believe. Which is why it never changes.

mysticssjgoku4 02-26-2007 12:04

Re: entity_set_size() Help / Model Solidification
 
Offset vectors? Explain please.

And why would something like this be even included in AMXX if I cannot really "work" with it :S.

Zenith77 02-26-2007 15:33

Re: entity_set_size() Help / Model Solidification
 
I'm not sure about the exact implementation or what I'm saying is correct, fyi. When I say offset vectors, it takes the entities current origin at w/e time and add those offsets to it to get the effect of a bounding box and do collision checks with the new vectors. You the values, I thought you just meant why doesn't it ever change (like when you move and stuff).

XxAvalanchexX 02-26-2007 19:46

Re: entity_set_size() Help / Model Solidification
 
http://avalanche.epherion.com/images/bbox.jpg

Here's a bounding box, in two dimensions. The blue dot is the entity's origin. The red dot is the entity's "max size." The green dot is the entity's "minimum size."

Since horizontally there are 24 pixels between the origin and the max size position, and vertically there are 48 pixels between the origin and the max size position, the max size (second parameter of EngFunc_SetSize) would be {24.0,48.0}.

Similarly, since horizontally there are 24 pixels between the origin and the min size position, and vertically there are 48 pixels between the origin and the min size position, but in the opposite direction, the min size (first parameter of EngFunc_SetSize) would be {-24.0,-48.0}.

Essentially, the mins and maxs are the distances from the origin of the entity to the two extreme corners of the bounding box of the entity. Note that in Half-Life, these are in 3D.

Ryu2877 02-27-2007 01:49

Re: entity_set_size() Help / Model Solidification
 
All the meanings of "size" is just like Avalanche's post, a little supplement:

the entity "origin" is not all the entity's center in many case, it is the entity's "eye-position" which tie to the entity's model.

for example, the "money-bag" model ( which use in my infinite money plugin) 's "origin" is at it's underside, that means it's "maxs" & "mins" size are not "symmetrical" parameter(z axis).
http://cs-friends.com.cn/bbs/UploadF...4511591412.jpg

sawce 02-27-2007 02:44

Re: entity_set_size() Help / Model Solidification
 
Angle only changes how the entity model is rotated. It does not affect bounding box.

mysticssjgoku4 02-27-2007 18:50

Re: entity_set_size() Help / Model Solidification
 
GG Half-Life.

Hawk552 02-27-2007 19:48

Re: entity_set_size() Help / Model Solidification
 
You can always calculate it manually, but I'd wish you luck with that.

mysticssjgoku4 02-27-2007 20:17

Re: entity_set_size() Help / Model Solidification
 
Quote:

Originally Posted by Hawk552 (Post 446452)
You can always calculate it manually, but I'd wish you luck with that.

Hahah yeah I had avalanche try and help me calculate an equation....lets just say I'm still trying to figure out shit.


All times are GMT -4. The time now is 00:40.

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