collision_box - what does it actually mean?

Place to get help with not working mods / modding interface.
Post Reply
User avatar
SkaceKachna
Burner Inserter
Burner Inserter
Posts: 11
Joined: Fri Aug 01, 2014 2:38 pm
Contact:

collision_box - what does it actually mean?

Post by SkaceKachna »

I've been trying to make my own variation of car, but I stumbled upon little issue.
I'm unable to define proper collision_box, since there is no reference on what those values actually mean:

collision_box = {{-1, -1}, {0, 0}},

it some kind of ratio - ratio of what? (definetly not of image size)
it isn't x,y,w,h or x1,y1,x2,y2, what is it then?

SilverWarior
Filter Inserter
Filter Inserter
Posts: 559
Joined: Mon Mar 04, 2013 9:23 am
Contact:

Re: collision_box - what does it actually mean?

Post by SilverWarior »

I'm not sure exactly but I would say those represent the two 2D points (corners) which define the colision boy. I asume these are probably UpperLeft and BottomRight point. And as you know 2D point positions are always expressed with two values X and Y position.
Now these positions are relative to object position. So -1, -1 probably means some position left and downwards of center position of object

User avatar
SkaceKachna
Burner Inserter
Burner Inserter
Posts: 11
Joined: Fri Aug 01, 2014 2:38 pm
Contact:

Re: collision_box - what does it actually mean?

Post by SkaceKachna »

Yea, looks like this is the case, the problem I had was different, I was looking at object rotated 90 to north, meaning the collision box was also rotated, but it was rotated against wrong center point, which caused very weird results.
I'm still interested what those ratios mean, but I can live without that :D

Rseding91
Factorio Staff
Factorio Staff
Posts: 13209
Joined: Wed Jun 11, 2014 5:23 am
Contact:

Re: collision_box - what does it actually mean?

Post by Rseding91 »

They're corner points: {{topLeftX, TopLeftY}, {BottomRightX, BottomRightY}} where each "1" is 32 pixels (one tile) in-game. You can turn on the grid view in-game to see how big one tile is.
If you want to get ahold of me I'm almost always on Discord.

User avatar
SkaceKachna
Burner Inserter
Burner Inserter
Posts: 11
Joined: Fri Aug 01, 2014 2:38 pm
Contact:

Re: collision_box - what does it actually mean?

Post by SkaceKachna »

Thank you for your answers, that exactly what I wanted to kno :D

Post Reply

Return to “Modding help”