Raised This Month: $208 Target: $400
 52% 

Entity mins and maxs - how to set properly


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
t3hNox
Senior Member
Join Date: Oct 2009
Old 06-21-2011 , 05:32   Entity mins and maxs - how to set properly
Reply With Quote #1

I've difficulties in setting mins and maxs for an entity. I know how to apply them and I have worked with entities before. However, now I am making a plugin and the size of an entity must be precise otherwise the plugin will fail.
Is there any information available about what point in 3D field each min and max (both are arrays with 3 cells) point define and where is the null point (origin of the entity, ground?). I would prefer an image if possible. And how could I display this entity in-game if I am not planning to set a model to it (I guess render (set_rendering) would be sufficient, but is it going to work if entity has no model ?).

I will appreciate any help.
t3hNox is offline
Hunter-Digital
Veteran Member
Join Date: Aug 2006
Location: In the Game [ro]
Old 06-21-2011 , 06:23   Re: Entity mins and maxs - how to set properly
Reply With Quote #2


Left bottom corner is mins and top right corner is maxs.
The values are offsets from the center... example:

Code:
entity_set_size(ent, Float:{-16.0, -16.0, 0.0}, Float:{16.0, 16.0, 32.0})
A 32x32x32 cube with the origin at the bottom.
__________________
Hunter-Digital is offline
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 06-21-2011 , 13:49   Re: Entity mins and maxs - how to set properly
Reply With Quote #3

Quote:
Originally Posted by Hunter-Digital View Post
A 32x32x32 cube with the origin at the bottom.
The origin is in the center of the box, not the bottom.
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 06-21-2011 , 16:12   Re: Entity mins and maxs - how to set properly
Reply With Quote #4

If the origin is 0, 0, 0 then wouldn't it be in the center of the bottom face of the cube?
__________________
fysiks is offline
t3hNox
Senior Member
Join Date: Oct 2009
Old 06-21-2011 , 17:15   Re: Entity mins and maxs - how to set properly
Reply With Quote #5

It means, I must calculate both min and max values from the center of the box ?
For example, if I have a regular figure 30 units in lenght (X axis), 20 in width (Y axis) and 10 in height (Z axis) then proper mins are -15.0 ; -10.0 ; -5.0 and maxs are 15.0 ; 10.0 ; 5.0?

edit: And what are the possibilities of displaying such entity ?

Last edited by t3hNox; 06-21-2011 at 18:39.
t3hNox is offline
Hunter-Digital
Veteran Member
Join Date: Aug 2006
Location: In the Game [ro]
Old 06-21-2011 , 18:44   Re: Entity mins and maxs - how to set properly
Reply With Quote #6

That's just the size of the collision box.
If you want to view it, you can send a couple of line messages that go from each coord to the other, making a box.
See plugins like "Info Zone" and such that have visual editing stuff, I remember that having a "draw_box()" stock.
__________________
Hunter-Digital is offline
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 06-22-2011 , 03:06   Re: Entity mins and maxs - how to set properly
Reply With Quote #7

Quote:
Originally Posted by fysiks View Post
If the origin is 0, 0, 0 then wouldn't it be in the center of the bottom face of the cube?
No. The origin is in the center of the mins/maxs.



The origin is where those 3 lines intersect.
The blue lines indicate the maxs, and the red lines indicate the mins.
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 06-22-2011 , 04:01   Re: Entity mins and maxs - how to set properly
Reply With Quote #8

Quote:
Originally Posted by Exolent[jNr] View Post
No. The origin is in the center of the mins/maxs.



The origin is where those 3 lines intersect.
The blue lines indicate the maxs, and the red lines indicate the mins.
So, you are saying that it's irrelevant to use -16 to 16 instead of 0 to 32.

Meaning that:

Code:
entity_set_size(ent, Float:{-16.0, -16.0, 0.0}, Float:{16.0, 16.0, 32.0})
is identical to:

Code:
entity_set_size(ent, Float:{-16.0, -16.0, -16.0}, Float:{16.0, 16.0, 16.0})
__________________
fysiks is offline
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 06-22-2011 , 06:03   Re: Entity mins and maxs - how to set properly
Reply With Quote #9

Quote:
Originally Posted by fysiks View Post
So, you are saying that it's irrelevant to use -16 to 16 instead of 0 to 32.

Meaning that:

Code:
entity_set_size(ent, Float:{-16.0, -16.0, 0.0}, Float:{16.0, 16.0, 32.0})
is identical to:

Code:
entity_set_size(ent, Float:{-16.0, -16.0, -16.0}, Float:{16.0, 16.0, 16.0})
It will create the same size box.
However, the origin will be on the bottom of the box since it has no mins below it.
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] is offline
t3hNox
Senior Member
Join Date: Oct 2009
Old 06-22-2011 , 07:04   Re: Entity mins and maxs - how to set properly
Reply With Quote #10

Thank you all for help, I found out everything I wanted
t3hNox is offline
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 20:45.


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