The Sword of my mod don't stay right in the hand

Because models made by the devs in qubicle are not centered at 0,0,0. They are shifted to the corner, in that case, you would want to move your model and make the grid box fit him also checking the “use bounding box as matrix”.

I can’t follow atm really. The model made with Magica Voxel wasn’t centered either and the whole point of using Voxelshop is to center it correctly, i. e. not to the corner (at least following the tutorial from above). The author himself seems to acknowledge that with his message to “Un-check for Stonehearth”. Or should I leave the imported model uncentered only to export it again with checked setting? Kinda stumped here, sorry.

If you edited the Piggy bank model in magicavoxel, and didn’t move the voxels around, then there’s no need to center anything in Voxelshop. The model exported from Magicavoxel should work with the default values in the json files, even if it doesn’t look centered in magicavoxel.

Ah, misunderstanding, sorry. I created a model from scratch in Magica Voxel and replaced the piggybank-model with the newly made .qb. Didn’t work because the model was not centered so I tried using Voxelshop which raised the issues I’m currently facing.

Ah, my bad then.

Yep, then you should center your model in the voxelshop bounding box (touching the ground) and use the settings that the program says for Stonehearth.

In magica, you have a box where you can edit your models inside of it, right? That box, no matter the size, is not centered at 0,0. The zero zero coordinate is one of its corners.
In Voxelshop, that option is for those that are working in a similar way, those that consider 0,0 a corner instead of the center.

Yep, that’s what I read. So, the conclusion I found online was that it’s impossible to center models within Magica Voxel correctly which I have tried to no avail before resorting to Voxelshop. Nothing really worked, that’s why I’m asking.

Most modders import existing models and edit over them. That gives them a hint of where the center should be.
I imported the piggy bank in Magicavoxel (latest version), painted over it, exported it, then imported it into Qubicle, and it is on the corner, exactly where it should be.

The pictures you posted above of your item in Voxelshop look correct.
You would need to export that with these settings:

  • Use compression : unchecked
  • Use bounding box as matrix : checked
  • Use origin as zero : unchecked
  • Use visibility mask encoding : unchecked
  • Use right handed z-axis orientation : checked

Then, if it still doesn’t look centered in game, in the piggy_bank_ghost.json file you might need to adjust the “model_origin”, which is

            "x": -0.05,
            "y": 0,
            "z": 0.05

to maybe something like 0.05, 0, -0.05.


Alright, gonna give it a try later, thanks.

Edit: Ok, I imported the piggy bank into Magica Voxel, changed only some voxels slightly without going outside the previous boundaries, exported it to qb, built it ingame and it’s off center.

Hmm which version of Magicavoxel are you using?
And did you revert the piggy bank json file? I think you mentioned before that you changed some values at some point?

Also, have you started a new game to test this? A savefile might have cached values.

Latest MV with a an unaltered ghost-json. Yep, always new games. How do you import into MV? I drag the qb into the window after I delete the file that is opened by default. Maybe it uses some coordinates from that one?

Personally I don’t delete anything from the default cube. I just drag the model and it replaces whatever was there.

If you zip your mod and upload it here, maybe we can check it. It’s really strange. It’s good to know the problems of other modders so that we can give better instructions in the modding guide.

OK, thanks so far. Will give it one more try with a completely clean slate again to see if I didn’t overlook something somewhere before I zip it (pun intended).

1 Like

Can’t you just align it through json? The model position doesn’t really matter. It is easier to have it centered in voxelshop because then your json position can simple be 0 0 and it will be centered in a terrain block, but it is not required, you can simple move a model left through json if it is too much to the right.

That might be a possibility though it would require figuring out in which directions the offset should be set and with which values. Other that that I just noticed that the exported test piggybank is mirrored so simply altering the json doesn’t seem to work in this special case at least.

Here’s the zipped mod if it’s of any help: (214.4 KB)

From the image it is correctly set in the corner, as expected from magica. Now all you need is shift the model half a block in json. And yes, Magica flips the model, it is a bug in their software.

1 Like

Aaaaalright, slowly getting there. Useful info here about Magica Voxel. Hopefully the last question: Do I have to change model_origin or region_origin and which values should I use?

model origin will move the object model, while region will move its collision box.
A value of 1 is a full terrain block.

Right now it’s sitting between four blocks. How do I know which one of the four is actually the right one? The lower right one probably, right?

If you add “enable_debug_keys” : true, in your user_settings.json, select the item and press F11, you’ll see 3 axis in the correspoding block.

But as BrunoSupremo hinted, if a value of 1 is a full block, and you need to move it by half block, the values for “model_origin” would be either 0.5 or -0.5, for x and z.