How do I centre models produced in MagicaVoxel?

I’ve decided to create m own mod (first time doing this sort of thing) and am basing it off expanding the archer class (one of my own hobbies). I’ve successfully created a new job (the Bowyer), and got all the basic UI and code sorted out. I’ve now hit a brick wall when trying to import my .qb files, as I can’t afford qubicle, and can’t seem to centre models in MagicaVoxel (when I open then re-export base game models it also breaks their origin). Any modders/modellers out there who can give me any tips on setting this up right?

sadly you can’t get things from magica to be centered in-game. however there is voxelshop, which works can be used to center items exported from magica, here’s a handy guide that shows how to center stuff properly in voxelshop,

http://discourse.stonehearth.net/t/the-sword-of-my-mod-dont-stay-right-in-the-hand/15465/10?u=8bitcrab

hopefully my reply makes sense, i haven’t had my coffee yet… :stuck_out_tongue:

3 Likes

Thanks man, that’s really helped out! Finally things are in their right place… if only I could model anything worth being in its right place!

1 Like

That is what I had to do MagicaVoxel then Voxelshop

This isn’t exactly true. No, you can’t center in magicavoxel, but you can do it in the game without having to use another program like voxelshop, by modifying the model_origin in the entity json files. Note: this is only true for non-animated entities, this won’t work for armor/clothing/weapons or any entity that has moving parts(not to be mixed up with objects that have effects added on like a water fountain or lamp) .

The easiest way to to install the debug_tools mod and use the entity editor to get your numbers.
I’ll use a market stall I created for a mod as an example because it’s the only one of my mods I currently have loaded in the game.

This probably looks like what yours does, and the defaults are X -0.5 and Z 0.5, depending on what you copied to create your entity. To move left, change the X Axis the negative amount to get it centered, and to move forward, the Z Axis positive. With this example, you see I need to move it left 2.5 and forward 1.5, so giving it a X of -2.5 and a Z of -2. (You will notice I didn’t have to move it a full -3 on X because the width is 6 blocks wide, and the Axis marker is a half of block off centered. If it were an odd number of blocks wide, you would get even numbers.)

Now it’s centered.

If you click the button I circled, it will bring up the json options that you can replace in your ghost file by just coping and pasting. After you save your ghost file, if you use the console command hotload_mod, or restart your game, and place down a new version of your item, you will see it match up.

Having even numbers for the model origin assumes you used a 10:1 ratio on your voxel. If not, you will have to play around with the numbers to get it centered. For example, one of mine has an X of -2.765 and Z of 1.95.

If you need any further clarification, ask away.

5 Likes