Collision boxes and sizes

Hi, I’m new to creating mods for Founder’s Fortune. At the moment, I have created a small mod for myself that adds decorative items to the game. The flowers I have modeled will get smaller in-game themselves and I apply a collider in furniture.json to similar object already in-game, but I also have a large barn object for example and I don’t understand how to set up its collider model.

“collider”: {
“boxes”: [{“center”: [1.0, 1.0, 1.0], “size”: [12.0, 12.0, 12.0],}],

What does those values mean? How can I set a large colliider for whole barn? Where do I get sizes of objects in-game? Do I set them somehow in Unity or just in json files? So many questions, can you please help me figure it out? Thank you in advance.

The sizes of objects corresponds to meters, so the walls are 2.3 meters high for instance. The collider box should roughly match the size of your item - if you have a large barn that isn’t meant to be entered as a building, but purely decorative, you can set up one box that is the size of the barn, and the center of the box should correspond to the center of the barn, in the coordinate system. The coordinates are X (left-right axis), Y (up-down axis) and Z (closer-further away).

I’m guessing your barn isn’t 12 * 12 * 12 meters, but maybe something like 10 * 3 * 5 or something like that. Off the top of my head I don’t think you can see the exact measurements in Unity, but you can in Blender. In Unity you should be able to view the item with a grid visible, though, and the grid is, or can be set to, meters, so it’ll give you an idea of the size.

Then for where the center of the box is, if the barn is centred, the collision box center would also be at X and Z = 0, while you’d need to “lift it” half it’s height to place the bottom of the box on the ground. So center, for the size mentioned above, would be 0, 1.5, 0.

The grid you see when building things in Founders’ Fortune also corresponds to meters, so if you’ve added the barn to the game you can always see how many squares it takes up, to get the size of it.

I hope this helps, though it might sound like gibberish when I try to explain :slight_smile:

1 Like

Hello CharlotteA,

to be honest, I get your explanation but at the same time I feel completely lost. :smiley: I’ve tried to change coordinates according to your explanation, but that doesn’t work. Maybe will be better if I upload you the mode and you can take a closer look at what I made and where I’m doing mistakes.

Download from my Dropbox

Also, I’m not sure what other stuff in furniture.json means, or what could I ommit or not. Can you please tak a look at that and tell me little bit more about structure of those files?

Hello again :slight_smile:
I think the existing tutorial is pretty good for explaining things enough to get you started, but I had a look at your files, and so here’s your furniture.json, with comments:

{
“jrbudovaa”: {
“wealth”: 10, //this means the item adds wealth to the colony
“beauty”: 10, //this adds to the beauty rating - which is usually for indoor items I think
“needsUpdate”: false, //this is true for things that change with the seasons or similar
“costResources”: [“wood”], //what it’s made of.
“buildPanelSection”: “decoration”, //the category in which you find your item, in game
“costCounts”: [1], //how much wood it costs to build your item
“collider”: { //prevents characters from waking through your item or other items to be placed too close/inside
“boxes”: [{“center”: [0.0, 4.0, 0.0], “size”: [9.0, 7.80, 14.0],}], //corrected values
//“boxes”: [{“center”: [10.0, 3.0, 5.0], “size”: [3.0, 3.0, 3.0],}], //previous values
“doesCharacterCollide”: true
},
“buildHeight”: 3.0, //what height the foundies work at, I think. So 1 or 2 might be better.
“dimensionsX”: 3.0, //determines whether 0 is at an intersection or between two intersections
“dimensionsZ”: 3.0, //same as above. These values need only be 1 or 2, and 1 is default
“modules”: {
“destroyable”: {
“maxHealth”: 25.0 //how much effort your enemies must make to destroy the item when they attack.
},
}
},
}

Basically, you can omit wealth, beauty, needUpdate, dimensionsX and dimensionsZ if you want to.
For resource cost, you can write [“wood”, “stone”] if you want two materials. Then you need to give a number for each in costCounts: [50, 25] (whatever numbers you find reasonable and balanced :slight_smile:
DimensionsX or Z is most useful for things like a bed, table or bench that is 2 meters in one dimension.

Back to the collider for a bit:
Your barn is 9 by 14 meters, and around 8 meters tall. It is placed approximately with it’s center at “0,0,0” of the coordinate system. A box of the same size will have it’s center (height wise) at 0, as well, which is why it needs to be “lifted” 4 meters into the air. Also, the collision box needs to go a bit above the ground (or you need to add an “inEarth: true” statement to the json) which is why I changed the height size from 8 to 7.8 (meaning it’s lifted a little more than half the box’s height).

collisionbox
Tried a small illustration too, hope it helps :slight_smile:

2 Likes

Hello CharlotteA, thank you so much for your response and tutorial, barn is working right now without any problems. Thanks to your explanation of how coordination and collider system works, I am now able to create so much low-poly decorations for the game. Once my mod will be ready to publish, I’ll upload it to Steam Workshop for everyone, I hope you’ll like it too. :slight_smile:

2 Likes

Glad I could be of help :slight_smile:
(I don’t use Steam, myself, though, but I’m sure those who do will be happy to see your mod!)

1 Like