Raised This Month: $ Target: $400
 0% 

entity_set_size() Help / Model Solidification


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
mysticssjgoku4
Veteran Member
Join Date: Jan 2005
Location: Chicago Heights, IL
Old 02-26-2007 , 11:49   entity_set_size() Help / Model Solidification
Reply With Quote #1

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;
}
__________________


Last edited by mysticssjgoku4; 02-26-2007 at 11:51.
mysticssjgoku4 is offline
Send a message via AIM to mysticssjgoku4 Send a message via MSN to mysticssjgoku4
Zenith77
Veteran Member
Join Date: Aug 2005
Old 02-26-2007 , 11:59   Re: entity_set_size() Help / Model Solidification
Reply With Quote #2

min/max are offset vectors from the entity's current origin, I believe. Which is why it never changes.
__________________
Quote:
Originally Posted by phorelyph View Post
your retatred
Zenith77 is offline
mysticssjgoku4
Veteran Member
Join Date: Jan 2005
Location: Chicago Heights, IL
Old 02-26-2007 , 12:04   Re: entity_set_size() Help / Model Solidification
Reply With Quote #3

Offset vectors? Explain please.

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

mysticssjgoku4 is offline
Send a message via AIM to mysticssjgoku4 Send a message via MSN to mysticssjgoku4
Zenith77
Veteran Member
Join Date: Aug 2005
Old 02-26-2007 , 15:33   Re: entity_set_size() Help / Model Solidification
Reply With Quote #4

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).
__________________
Quote:
Originally Posted by phorelyph View Post
your retatred
Zenith77 is offline
XxAvalanchexX
Veteran Member
Join Date: Oct 2004
Location: abort73.com
Old 02-26-2007 , 19:46   Re: entity_set_size() Help / Model Solidification
Reply With Quote #5



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.
__________________
No longer around. Thanks your support, everyone! As always:
THIS ONES FOR YOU
3000 PTS
XxAvalanchexX is offline
Ryu2877
Member
Join Date: Sep 2006
Location: China
Old 02-27-2007 , 01:49   Re: entity_set_size() Help / Model Solidification
Reply With Quote #6

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).
Ryu2877 is offline
sawce
The null pointer exception error and virtual machine bug
Join Date: Oct 2004
Old 02-27-2007 , 02:44   Re: entity_set_size() Help / Model Solidification
Reply With Quote #7

Angle only changes how the entity model is rotated. It does not affect bounding box.
sawce is offline
mysticssjgoku4
Veteran Member
Join Date: Jan 2005
Location: Chicago Heights, IL
Old 02-27-2007 , 18:50   Re: entity_set_size() Help / Model Solidification
Reply With Quote #8

GG Half-Life.
__________________

mysticssjgoku4 is offline
Send a message via AIM to mysticssjgoku4 Send a message via MSN to mysticssjgoku4
Hawk552
AMX Mod X Moderator
Join Date: Aug 2005
Old 02-27-2007 , 19:48   Re: entity_set_size() Help / Model Solidification
Reply With Quote #9

You can always calculate it manually, but I'd wish you luck with that.
__________________
Hawk552 is offline
Send a message via AIM to Hawk552
mysticssjgoku4
Veteran Member
Join Date: Jan 2005
Location: Chicago Heights, IL
Old 02-27-2007 , 20:17   Re: entity_set_size() Help / Model Solidification
Reply With Quote #10

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

mysticssjgoku4 is offline
Send a message via AIM to mysticssjgoku4 Send a message via MSN to mysticssjgoku4
Reply


Thread Tools
Display Modes

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 00:40.


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