adjusting image to collision box

Place to get help with not working mods / modding interface.
keneda83
Burner Inserter
Burner Inserter
Posts: 14
Joined: Thu Aug 04, 2016 1:19 pm
Contact:

adjusting image to collision box

Post by keneda83 »

Hello guys i'm trying to make my own picture for a building but i'm having pain to adjust the pics to the collision box does anyone can explain how the picture is loaded and how it work with the collision box? thanks in advance for any help!
User avatar
aubergine18
Smart Inserter
Smart Inserter
Posts: 1264
Joined: Fri Jul 22, 2016 8:51 pm
Contact:

Re: adjusting image to collision box

Post by aubergine18 »

There's three settings - collision_box (footprint of the entity on the ground), drawing_box (actual size of the entity) and selection_box (where the selector lines will be drawn if player hovers/clicks entity).

Each has an area object - { {left,top}, {right,bottom} } where those values are offsets from the centre of your object (as far as I can tell). A map tile is 32px square, so a value of 1 will represent 1 tile. If your entity is 1x1 footprint, then the collision box would be something like { {-0.5,-0.5}, {0.5, 0.5} } (I think?!)

For more infos, see https://wiki.factorio.com/index.php?tit ... ype/Entity
Better forum search for modders: Enclose your search term in quotes, eg. "font_color" or "custom-input" - it prevents the forum search from splitting on hypens and underscores, resulting in much more accurate results.
keneda83
Burner Inserter
Burner Inserter
Posts: 14
Joined: Thu Aug 04, 2016 1:19 pm
Contact:

Re: adjusting image to collision box

Post by keneda83 »

thanks you very much for replying me, i think i got what you mean , and ty for the link i think i gonna help me alot!
User avatar
aubergine18
Smart Inserter
Smart Inserter
Posts: 1264
Joined: Fri Jul 22, 2016 8:51 pm
Contact:

Re: adjusting image to collision box

Post by aubergine18 »

In game, if you press F4 you get a debug panel appearing - there are two options that will help:

Image

It draws the actual boxes so you can see exactly where they are:

Image
Better forum search for modders: Enclose your search term in quotes, eg. "font_color" or "custom-input" - it prevents the forum search from splitting on hypens and underscores, resulting in much more accurate results.
keneda83
Burner Inserter
Burner Inserter
Posts: 14
Joined: Thu Aug 04, 2016 1:19 pm
Contact:

Re: adjusting image to collision box

Post by keneda83 »

thanks you very much for this great tips , but it don't help my problem with my grafics maybe a screenshot can help understand

So, basicly i want to adjust the bottom left right of my building with the collision/selection box and allow the picture to be fully displayed, i tried to play with the drawing box but no luck.
Attachments
building.png
building.png (605.22 KiB) Viewed 3515 times
User avatar
Arch666Angel
Smart Inserter
Smart Inserter
Posts: 1636
Joined: Sun Oct 18, 2015 11:52 am
Contact:

Re: adjusting image to collision box

Post by Arch666Angel »

First off: Your sprite is way bigger than your collisionbox, so you should adjust that via collision_box and selection_box, the collision_box should be a tad smaller than the selection_box.

If you want to move the sprite relative to the collision_box you need to use the shift value specified with the sprite.
keneda83
Burner Inserter
Burner Inserter
Posts: 14
Joined: Thu Aug 04, 2016 1:19 pm
Contact:

Re: adjusting image to collision box

Post by keneda83 »

ok thanks you very much for these info i will try to play with those shift option (how does it work exactly? , it just have X and Y right? and it appliy from the center of the entity?) and probably reqize my picture
User avatar
Arch666Angel
Smart Inserter
Smart Inserter
Posts: 1636
Joined: Sun Oct 18, 2015 11:52 am
Contact:

Re: adjusting image to collision box

Post by Arch666Angel »

the game renders from left to right and from top to bottom, so the y axis is inverted (+ down, - up)
Nexela
Smart Inserter
Smart Inserter
Posts: 1828
Joined: Wed May 25, 2016 11:09 am
Contact:

Re: adjusting image to collision box

Post by Nexela »

Arch666Angel wrote:the game renders from left to right and from top to bottom, so the y axis is inverted (+ down, - up)
....Really wish I knew this earlier.......
keneda83
Burner Inserter
Burner Inserter
Posts: 14
Joined: Thu Aug 04, 2016 1:19 pm
Contact:

Re: adjusting image to collision box

Post by keneda83 »

thanks evryone for this help i managed to make something better
Post Reply

Return to “Modding help”