Page 1 of 1

collision_box - what does it actually mean?

Posted: Wed Aug 06, 2014 9:10 pm
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?

Re: collision_box - what does it actually mean?

Posted: Thu Aug 07, 2014 12:59 pm
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

Re: collision_box - what does it actually mean?

Posted: Thu Aug 07, 2014 5:57 pm
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

Re: collision_box - what does it actually mean?

Posted: Thu Aug 07, 2014 7:00 pm
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.

Re: collision_box - what does it actually mean?

Posted: Sat Aug 09, 2014 7:33 pm
by SkaceKachna
Thank you for your answers, that exactly what I wanted to kno :D