Model alignment with StoneVox 3D

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:

  1. @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?
  2. 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?
  3. What sets the item’s physical boundaries / collision detection?
  4. 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!

3 Likes

ive had this problem before with making weapons so honestabelink made this version of stonevox where u can pick where your origin is…normally stonevox puts in in the centre which is probably why yours are on the lines in between voxels (if you made it 11x11x11 it should work as well )

http://www.mediafire.com/download/jam7hr3p9bcgrmd/stonevox3d+reliner.zip

this is an older stonevox so it has some different features but is also missing some features

the center aligned one is useful for iconics where u want it to be centered, and the one where u pick where u want the origin is really useful for weapon making (you find the square you want the handle to be held and look at the numbers and then make the origin move to that spot by putting the same numbers with minuses in front of them that way the person will be holding it on that specific square

im sure honest would tell you this but i think something must have happened to make him really busy because he kind of just…dissapeared last week and i havent heard from him since lol

oh and the spot where u edit the origin is underneath the matrix list in this one

2 Likes

Mostly for others and future reference as I’ve read your update :wink:

The current release of StoneVox from the main post allows for setting origin offsets, I’d recommend picking up the most recent release.

Thank you though @Heimerdinger.

The origin by default is set to 0,0,0. mouse around the floor in StoneVox and you can get an idea where 0,0,0 is

StoneVox provide a global position offset setting that is applied to every matrix in the .qb. In the .qb export setting screen is where you can find the setting. In the future you will be able to adjust per matrix.

If you entity is placeable in the world…

The ghost.json/iconic.json should be where you should specify model offsets that can’t be achieve by .qb file format.

ghost is the placed version in the world
iconic in the stockpile version

See, in programming there are various ways to store number values. Some allow for great precision, others do not. The particular form used in the .qb file format for storing positions doesn’t store fraction/decimal numbers. In short you should used StoneVox to get as close to the offset you are looking for and then finalize the movement by specifying

"mob" : {
        "model_origin" : { "x": 0, "y": 0, "z": 0 },
        "region_origin" : { "x": 0.5, "y": 0, "z": 0.5 }
},

with values you see fit. These can just be found though testing, or taking into the account the size of your model and it’s origin offset. The values here can be different from model to model. If yours work and it rotates as expected then I’d say it’s good and don’t worry about it :wink:

Just for an example if you’d like to get an object as centered as possible, export the model form StoneVox at negative the size of model divide by 2.

So

Model is 10,10,10.

Export Origin -5,0,-5

If you’d like, as in your case, to match the model to the world grid, you’d export at 0,0,0. This will however cause various rotation problems I believe as the model will rotate around it’s corner rather than it’s center, also the entity while being placed will not be centered under the mouse.

"region_collision_shape": {
    "region": [
        {
            "min": {
                "x": -1,
                "y": 0,
                "z": -1
            },
            "max": {
                "x": 1,
                "y": 1,
                "z": 1
            }
        }
    ]
}

Look at other entities to get an idea on how big 1 is and such. Basically view this a starting point and an ending point.
Both points are used to create a volume of space that is the collider.

In this case the start position is to the left (x : -1) and back (z : -z), the endpoint is then stretched over and up. Hope that makes sense :wink: .

The way is works is x represents left and right. y is up and down. and z is forward and back.

-x left
+x right

-y down
+y up

-z back
+z forward

This is most likely the case, I don’t know if you can but try removing the region_collision_shape component, or setting the values low or off to the another side, and see what happens.

Yes the beginning, like anything, will be full of hurdles that once you know you’ll be like, wow thats so simple now that I know :slight_smile: Best of luck with you project, can’t wait to see it.

2 Likes

Thank you for the detailed reply! I’ll take another jab at this mod this week! :smile:

2 Likes