Is it possible to get the size of an entity?

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.

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

1 Like

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.

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.