# What Does Calculate Extends in Magos Actually do?

Status
Not open for further replies.

#### Hantoo

Level 42
What Does Calculate Extends in MagosModelEditor Actually do to the Model?
All I know is It fixes alot of stuff such as "Unclickable", Or something like Portrait.

What kind of magic it doned to the model? I mean, If I can change the setting Manually, would be better (i guess?)
can it be done manually?

#### GhostWolf

Level 29
It re-calculates the extents, which define the bounding sphere (or cube) of a model, which in turn is used for selection and pathing.
The idea is to get the smallest and biggest coordinates for each of the axes, by looping over all of the vertices, and that's your extent (the distance between the two resulting vertices is also saved).

#### Hantoo

Level 42
It re-calculates the extents, which define the bounding sphere (or cube) of a model, which in turn is used for selection and pathing.
The idea is to get the smallest and biggest coordinates for each of the axes, by looping over all of the vertices, and that's your extent (the distance between the two resulting vertices is also saved).

So Does it have something that changes the Unit's Health bar height? Some times my model's Health bar get super high and I don't know how to fix... Does it Relate to Calculate extends?

#### GhostWolf

Level 29
I assume the game uses the bounding shape also for that, yes.

#### Fingolfin

Level 45
The model extends are mainly for telling the game weather the model collides with the camera bounds. For instance, if you have a very large model, it's extents will have to be scaled appropriately, otherwise it will not render when the models origin point is outside of view. Extents are also used for selection - the game first checks if the mouse collides with the extents, and if it does, it checks for any bounding shapes for more precise collision.

#### Ezekiel12

Level 12
The model extends are mainly for telling the game weather the model collides with the camera bounds.
Can you explain a bit more about the rendering process? I.e. when a model is rendered/not rendered and what factors decide this. I had issues in many maps where models are not rendered though they should be (e.g. here on the right side of the screen). Is this only because of the model extents or is there some bug in wc3?

#### PurgeandFire

Level 44
Can you explain a bit more about the rendering process? I.e. when a model is rendered/not rendered and what factors decide this. I had issues in many maps where models are not rendered though they should be (e.g. here on the right side of the screen). Is this only because of the model extents or is there some bug in wc3?

Yes, it is as you linked (the big tower disappears). The camera uses the bounding box/sphere to determine whether a model should be rendered on screen (taken from the object's coordinates). If you extend that bounding sphere, you can avoid those "disappearing" models (since it'll still be considered in the field of view). But it isn't always the best idea--in cases like the video you linked, if you extended the bounding sphere, the camera might clip into the model which would look strange to the viewer.

But you should extend the bounding sphere if you scale the model in the editor. I don't think wc3 actually takes into account scaling when it checks model extents, so increasing the extents manually will give you a better result. Unfortunately you'll run into issues when you use the same model with many different scales, in which case you should just choose the extents of the largest scaled object.

I don't know which tools allow you to set extents manually (magos' editor might). But it should be easy to write a program that sets it if you need that feature. (and if you set new extents, you would just multiply the old extents by the scaling value, e.g. extent * 1.25 if you are scaling the model 1.25 in the editor).

#### Ezekiel12

Level 12
I don't think wc3 actually takes into account scaling when it checks model extents
Here we go, that's (kind of) the bug I wanted! There seems to be more to the story though.
The collision spheres/boxes are scaled with scaling value but it seems the model extents are not or only partially. For example until a certain scaling value the hp bar height increases. If you increase scaling value above that the hp bar stays at the max height. Maybe that's also the case with the extents and therefore the model rendering.

#### Fingolfin

Level 45
I don't think this is your problem. Extents should scale fine, but inaccuracies will become more evident at large scales. Also note that destructables have a hardcoded maximum for their extents, so they might dissapear even though you set their extents to something very high. In those cases it is best to use doodads if possible, since they don't have this problem.

It is possible to set extents manually in magos model editor. Just open the model, then go to edit>model properties, and there you have your extents.

#### Ezekiel12

Level 12
I don't think this is your problem. Extents should scale fine,
I was talking about ingame scaling, i.e. scaling value in Object Editor or scaling via trigger.
That's what Purges quote was about, right?
I don't think wc3 actually takes into account scaling when it checks model extents

Last edited:

#### Fingolfin

Level 45
Yes, that is what i was refering to - i do believe that scaling a unit in the object editor also scales extents, i doubt Blizzard would have missed this. Instead, think of it like this: when a model is scaled very small, the distance between the origin and the edge of the extents is so small, that you will not really notice when the origin goes outside of camera bounds. On models that are scaled very large, it's much more noticeable.

#### Ezekiel12

Level 12
Yes, that is what i was refering to - i do believe that scaling a unit in the object editor also scales extents, i doubt Blizzard would have missed this. Instead, think of it like this: when a model is scaled very small, the distance between the origin and the edge of the extents is so small, that you will not really notice when the origin goes outside of camera bounds. On models that are scaled very large, it's much more noticeable.

What I know for sure is if you place a huge Bloodmage with scaling value 40, the mouse hover detection will work fine anywhere on the model as long as it is rendered. The problem is if a small region around the center is not in the camera field anymore the model won't be rendered.

So my guess was that extents are only scaled up to a certain value. (The health bar that has a max height would confirm this).

Either that or rendering is completely independent from extents and collision shapes and just always is some kind of shape around the object..

Status
Not open for further replies.

Replies
2
Views
708
Replies
6
Views
1K
Replies
2
Views
636
Replies
7
Views
826
Replies
4
Views
367