Multiple models (is it possible?)

Here is what I want to do:
I want to add an entity, which has multiple models in the ghost. This means when I place said entity, all models will show. However, I want to determine the “model_origin” of each separately (I need to place models at 1/4th voxel intervals).

There are a few ways in which I think i could do it, but I don’t know whether they are possible:

  1. Having multiple ghost.jsons. Each regulate their own model, but they are named in the normal .json like this: “model_variants” : { “ghost” : [ “ghost1.json”, “ghost2.json”, “ghost3.json” ] }
  2. having multiple "mob"s in the ghost.json
  3. making the model in a different 3D model format, other than .qb, which
    • doesn’t care about voxels, and thus can place cubes at 1/4 of their size
    • Can be read by stonehearth

Other unrelated solutions to the problem I want to solve would be

  1. rescaling it in only one dimension (y-axis only)
  2. making the model 4 times bigger in all directions, and scaling it back in-game.
    • this makes my models 64x bigger, and scince i have to do to 7 models, they will eat up about 85 MB in storage space, so I don’t want to do this.

Does anyone know more about the possibility of these solutions, or a different solution?

I’m not too sure what you wish to do (I’m still limited in my English-understanding), but perhaps I could add some light regarding how I solved “multiple models in one entity” for the tombstones in my Commemorative Items mod.

"components": {
      "model_variants": {
         "default": {
            "models": [
               "file(file_icon.qb)",
			   "file(file_left.qb)",
			   "file(file_center.qb)",
			   "file(file_right.qb)"
            ]
         }
      },
	  "render_info": {
				"scale": 0.033
      },
      "mob": {
         "model_origin": { "x": -0.65, "y": 0, "z": 0.33 },
         "region_origin": { "x": 0.5, "y": 0, "z": 0.5 }
      }
   },

Above is some example code, very similar to that of a ghost-entity of my tombestones.
There are 4 models in total (icon; left; center; right) - the ghost entity consists of them all; meaning, rather than seeing this as 4 models, Stonehearth see this as one collected entity.
The limitation my code brings to the table, if I understand how these JSON-files are intepreted by Stonehearth, is that this will not allow you to control model origins seperately.

Instead, if you wish to produce individual components with their respective model origin, you would have to set up a JSON with several “components” parts - if this is possible I do not know, but my suggestion to find out would be to try something similar to my example below:

"components": {
"component1": {
      "model_variants": {},
	  "stonehearth:entity_forms": {},
	  "render_info": {},
	  "mob": {},
      "region_collision_shape": {}
   },
"component2": {
      "model_variants": {},
	  "stonehearth:entity_forms": {},
	  "render_info": {},
	  "mob": {},
      "region_collision_shape": {}
   },
}

I only suggest this approach, as to me it seems that setting up several “mob” within one “components” will not allow you to control your models seperately. (This means that I personally don’t suggest going forward with either 1, 2, 3 from your first list)

You can scale your models by changing the values of

"render_info": {
				"scale": 0.033
      },

This will rescale it along the x axis, y axis, and z axis. I have not come across any code that produce rescaling along only one axis.

If I recall my math correctly, in the example seen above a 3x3x3 voxel in the .qb-file will become equal in size to one singular voxel in a 10x10x10 model. Ergo, a model of a 30x30x30 solid box would shrink to a 10x10x10 box within Stonehearth (the size of one environment block).
Put smaller numbers to decrease the scale; put bigger numbers to increase the scale.

If it is possible to set up a JSON with several “components”, you will also be able to set various “render_info”.
Again, I do not know if this is possible - but, the way I see it, there’s no harm in trying :slight_smile:

Best of luck!

1 Like

From what I read, you understand what I mean.


I also knew about this one, and I knew the limitations. The only outlining you can do here is in 1 vx intervals, inside the model file, but not the 1/4 I need.


oh, I know. But here is the thing. To make the model appear the same size in-game, I need to replace every voxel for a 4x4x4 vx cube in voxelshop, making the size of the model file 64x as big as the original model was. Then I need to set the scale at 1/4th to render all those 4x4x4 vx cubes as what appears to be single voxels, but this time with the changes in model outlining that I wanted. This file size is the problem I want to avoid.


I don’t think changing “components” to “component1” and “component2” and “componentN” will work, as the game’s code will look for “components”, which it will not find, causing my model to bug out. If there is a way, then the game knows what that way is (it could be what you suggested, but I don’t want to guess as to what strings will trigger the effects if any, hence this thread), since it actively looks out for it whilst loading the files (i.e., it is prepared to read it.)


I hope a solution does turn up. If it doesn’t, then I guess the models will not be stackable (the reason I do this is cuz I need to make a gap of 1 voxel disappear, and I want to smear it out over four layers of ingots to prevent them from looking weird).

You can move different models, or different matrixes, using animations. That’s how I made a diagonal track seen here:

In that, I just rotated it, but you can also translate to the position you want.

3 Likes

My suggestion was not to replace “components” with “component1”, but to insert “component1” and “component2” within the original “components”.
However, I did some testing this morning - although the game does not crash and does not provide me any report, it is not possible to “stamp” my entity. Thus, I’m guessing my thought does not work anyways.

I think @BrunoSupremo has a really good suggestion - using animations you should be able to stick to the original 1-voxel size and still re-position your blocks in steps of 1/4th (or any size, really). Good idea, Bruno!

Oh, sorry for misreading your suggestion. :slightly_smiling_face:


I will try your suggestion @BrunoSupremo, thanks :smile: