# Is it possible to get the size of an entity?

**URL:** <https://discourse.stonehearth.net/t/is-it-possible-to-get-the-size-of-an-entity/38470>\
**Category:** Scripting & Code\
**Created:** [November 2, 2018, 3:46pm UTC](https://discourse.stonehearth.net/t/is-it-possible-to-get-the-size-of-an-entity/38470 "2018-11-02T15:46:41Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![BrunoSupremo](https://sea2.discourse-cdn.com/flex022/user_avatar/discourse.stonehearth.net/brunosupremo/32/54819_2.png) [@BrunoSupremo](https://discourse.stonehearth.net/u/BrunoSupremo)\
**Post date:** [November 2, 2018, 3:46pm UTC](https://discourse.stonehearth.net/t/is-it-possible-to-get-the-size-of-an-entity/38470/1 "2018-11-02T15:46:41Z")

</div>

Is it possible to get the size of an entity? As the actual space it occupies in the world?  
Example, a squirrel fits in a 1x1x1 space while a hearthling is in a 2x2x4  
My goal is to detect and have proper traps for different entity sizes, so a small critter would have a small trap while a bigger one would have a bigger trap.

---

<div class="post-metadata">

**Author:** ![paulthegreat](https://sea2.discourse-cdn.com/flex022/user_avatar/discourse.stonehearth.net/paulthegreat/32/62395_2.png) [@paulthegreat](https://discourse.stonehearth.net/u/paulthegreat)\
**Post date:** [November 2, 2018, 5:17pm UTC](https://discourse.stonehearth.net/t/is-it-possible-to-get-the-size-of-an-entity/38470/2 "2018-11-02T17:17:56Z")

</div>

One thing you can do is get the area (volume) of the collision region:

```lua
entity:get_component('region_collision_shape'):get_region():get():get_area()

```

---

<div class="post-metadata">

**Author:** ![BrunoSupremo](https://sea2.discourse-cdn.com/flex022/user_avatar/discourse.stonehearth.net/brunosupremo/32/54819_2.png) [@BrunoSupremo](https://discourse.stonehearth.net/u/BrunoSupremo)\
**Post date:** [November 2, 2018, 10:10pm UTC](https://discourse.stonehearth.net/t/is-it-possible-to-get-the-size-of-an-entity/38470/3 "2018-11-02T22:10:43Z")

</div>

That is interesting for static objects and items with actual collision boxes. But it does not work for mobs like a fox.

For now I will simple use entity\_radius within the entity data, but that is usually a guessed/approximated value. That is also based on the default entity size, while I wanted to actually have the correct size even if the same entity was scaled up or down.

---

<div class="post-metadata">

**Author:** ![max99x](https://sea2.discourse-cdn.com/flex022/user_avatar/discourse.stonehearth.net/max99x/32/40094_2.png) [@max99x](https://discourse.stonehearth.net/u/max99x)\
**Post date:** [November 3, 2018, 12:06am UTC](https://discourse.stonehearth.net/t/is-it-possible-to-get-the-size-of-an-entity/38470/4 "2018-11-03T00:06:23Z")

</div>

On the server, the collision box and the entity reach are probably as good as you’ll get. If you’re on the client, you can get the bounding box of the render node (search the code for “`aabb`” to find examples), and in theory can send it back to the server if needed.
