Hi, I’m working on a small surprise at the moment but I’m having trouble aligning my models in-game.
They are 10x10x10 in size, meant to be flush with the ground and to fit perfectly within one world voxel. I modeled them with StoneVox 3D, and have no idea where the origin is, nor how to align items through their mod files.
Currently, the items I’ve added are centered on the lines between world voxels, such that the corners of my models are perfectly centered in world voxels:
To add to my problems, there seems to be a collision problem, though I don’t think I can comment on it until the models appear where they should be.
My questions are:
- @honestabelink (or anyone else knowledgeable), where does StoneVox set the origin to be? Is it centered or is it at the corner piece of the model?
- Which file sets the alignment of the model in-game? Is it the code within ‘Region_collision_shape’ in the item’s .JSON? Is it the model_origin bit in the model_ghost.json? Or is it the region_origin in the model_ghost.json?
- What sets the item’s physical boundaries / collision detection?
- Do the x-y-z coordinates reflect horizontal translations (x,y) and vertical height (z) or am I mistaken with the direction of my axes?
Here’s what I’ve got, based on honestabelink’s item-adding tutorial:
From the item.json:
"region_collision_shape": {
"region": [
{
"min" : { "x" : -0.5, "y" : 0, "z" : -0.5 },
"max" : { "x" : 1.5, "y" : 1, "z" : 1.5 }
}
]
}
From the item_ghost.json:
"mob" : {
"model_origin" : { "x": 0, "y": 0, "z": 0 },
"region_origin" : { "x": 0.5, "y": 0, "z": 0.5 }
}
I’ve played with the values with little success… a lot of the time, the models just disappear.
UPDATE:
It’s taken a while (and about 15 new game starts) but I’ve sorted this out, somewhat… here are the values I’ve set:
"region_collision_shape": {
"region": [
{
"min" : { "x" : -1, "y" : 0, "z" : 0 },
"max" : { "x" : 0, "y" : 1, "z" : 1 }
}
]
}
and
"mob" : {
"model_origin" : { "x": -0.5, "y": 0, "z": 0.5 },
"region_origin" : { "x": -0.5, "y": 0, "z": 0.5 }
}
I had my coordinates mixed up. Y corresponds to height rather than being a horizontal measurement. This seems to be working for now, and I sorted out the collision problems, but there are occasional issues where items will not be placed in some blocks of dug-out areas - often corners for some reason. Correct me if I’m wrong, but my understanding is that the region_collision_shape code in the item.json sets the item boundaries for collision detection. I think that it could be sensing that the dirt voxels the item is being placed next to are in the way, even though they aren’t really.
Anyways, more experimenting for me, hope I can show this mini-project off soon!