AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Entity mins and maxs - how to set properly (https://forums.alliedmods.net/showthread.php?t=159752)

t3hNox 06-21-2011 04:32

Entity mins and maxs - how to set properly
 
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.

Hunter-Digital 06-21-2011 05:23

Re: Entity mins and maxs - how to set properly
 
http://www.faludi.com/images/blog/cube.jpg
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.

Exolent[jNr] 06-21-2011 12:49

Re: Entity mins and maxs - how to set properly
 
Quote:

Originally Posted by Hunter-Digital (Post 1492690)
A 32x32x32 cube with the origin at the bottom.

The origin is in the center of the box, not the bottom.

fysiks 06-21-2011 15:12

Re: Entity mins and maxs - how to set properly
 
If the origin is 0, 0, 0 then wouldn't it be in the center of the bottom face of the cube?

t3hNox 06-21-2011 16:15

Re: Entity mins and maxs - how to set properly
 
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 ?

Hunter-Digital 06-21-2011 17:44

Re: Entity mins and maxs - how to set properly
 
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.

Exolent[jNr] 06-22-2011 02:06

Re: Entity mins and maxs - how to set properly
 
Quote:

Originally Posted by fysiks (Post 1493032)
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.

http://i.imgur.com/s522R.png

The origin is where those 3 lines intersect.
The blue lines indicate the maxs, and the red lines indicate the mins.

fysiks 06-22-2011 03:01

Re: Entity mins and maxs - how to set properly
 
Quote:

Originally Posted by Exolent[jNr] (Post 1493286)
No. The origin is in the center of the mins/maxs.

http://i.imgur.com/s522R.png

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})
:?:

Exolent[jNr] 06-22-2011 05:03

Re: Entity mins and maxs - how to set properly
 
Quote:

Originally Posted by fysiks (Post 1493301)
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.

t3hNox 06-22-2011 06:04

Re: Entity mins and maxs - how to set properly
 
Thank you all for help, I found out everything I wanted :)


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

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