I am trying to figure out a general way to find the collision box for an entity on the map. Every entity has entity.bounding_box, but this is not the same as the collision box. For entities that are not rotated it looks like you can find the collision box by taking entity.prototype.collision_box and moving it to entity.pos, but from what I can tell this doesn't work for cliffs, because the prototype collision box for cliff doesn't contain orientation.
What is the general algorithm for finding the collision box of an entity?
Entity collision box
Re: Entity collision box
" it looks like you can find the collision box by taking entity.prototype.collision_box and moving it to entity.pos" That's what entity.bounding_box does for you. So what exactly is the problem with using that?
I'm an admin over at https://wiki.factorio.com. Feel free to contact me if there's anything wrong (or right) with it.
Re: Entity collision box
Cliffs have unique name for every rotation.
Re: Entity collision box
Bilka, looks like you are right. I was confused and thought and collision and bounding box are two different things. Now I checked again with a few entities, and it looks like bounding_box is just collision_box from prototype plus position. Thanks.That's what entity.bounding_box does for you.
- eradicator
- Smart Inserter
- Posts: 5211
- Joined: Tue Jul 12, 2016 9:03 am
- Contact:
Re: Entity collision box
Bounding_box has no description whatsoever in the api doc btw... ;)Bilka wrote: Sat Jun 08, 2019 4:43 pm " it looks like you can find the collision box by taking entity.prototype.collision_box and moving it to entity.pos" That's what entity.bounding_box does for you. So what exactly is the problem with using that?
Might even be worth writing an additional comment in EntityPrototype.collision_box.
Author of: Belt Planner, Hand Crank Generator, Screenshot Maker, /sudo and more.
Mod support languages: 日本語, Deutsch, English
My code in the post above is dedicated to the public domain under CC0.
Mod support languages: 日本語, Deutsch, English
My code in the post above is dedicated to the public domain under CC0.
Re: Entity collision box
Fixed :)eradicator wrote: Sat Jun 08, 2019 5:51 pm Bounding_box has no description whatsoever in the api doc btw... ;)
I'm an admin over at https://wiki.factorio.com. Feel free to contact me if there's anything wrong (or right) with it.