Regardless of the size of the window, it places correctly for North and East positions, but offsets by 1 for South and West positions. This also extends to the iconic file, as when placing it with dev tools, it shows own direction but when placed, rotates 90 degrees.
Do you have debug enabled? (Those little icons on top right)
If so, one of them (can’t remember which, just test it all) is useful to align the items into the correct position.
To add a collision to your entity, you can also do in that same debug, you add a hitbox and align it as you want, then it generates a json to you that you can copy into your files.
It’s written as a window, which originally I used that debug tool to figure out the alignment. Problem is, once you place them in a wall and then change their position, they disappear completely.
Oh, forgot to add that out of a wall, they rotate just fine when being placed with the dev tools.
While it should work, it creates a smallish problem as a side effect: windows create cramped environment because they have hitboxes, what makes no sense as in real life rooms with windows seem lest cramped and if you need space you’d like to have a window. I haven’t tested it yet but there may be a different way to prevent Hearthlings from going through windows. Taken from wooden_window_frame_tall.json:
I guess setting the modifiers to -1 makes them not use the windows to pass at all. Of course you’d have to modify the region so it covers the glass part of your window. I’m not sure whether it works or is an old feature not working anymore.
For the rotation error there is a simple trick to fix it: you need to alter region origin, set x: 0.5 and z: 0.5. This way rotation is done while centered on a tile instead of an edge (what may cause the integer tile coordinates to change).
By changing the region like you said, it fixes the rotation when placed on the ground, as well as the hitbox rotates with it. It does not, however, fix the rotation when placed in walls as windows. But thank you for sharing this as it fixes other objects thus far.
I remember having the very problem with some Archmod prototypes. For windows aligning to x axis (and only x) usually does the trick. Sadly there’s the disappearing window problem which makes Entity Editor useless for properly setting model origins for windows so you have to modify the .json, restart Stonehearth and place a new window via Item Stamper every time.
Align to grid fixes the rotation problem, and makes the window rotate properly. But then it also places the model one square to the right too far. And if you add the model origin code after the align to X, it cancels it out.
with the model origin and region define, it flips it so the north and east rotations are wrong, but the south and east are right. I’m ready to nuke this game…
@pingu was telling me in a message though that it’s a misalignment with the model, being I’m using MagicaVoxel and not Qubicle. Is there anymore insight to this?
@pingu is right, you should have the model origin as close to the center of the model’s base (that is: centered in x and z but y = 0) as possible. This should be done via .qb, not using model_origin as it gets superbuggy when axis alignment is used. I use Qubicle so I don’t know how to fix that in MV, upload your .qb file if you want me to check it in Qubicle.
That is actually the intended use for that setting… That is what is for, to center things, or to move it. Even using Qubicle you can’t always get the position you want.
I’m trying to catch-up on what’s going on here, but there’s one thing I want to ask that I do not see an answer for yet.
Before exporting your .qb-file from MagicaVoxel, did you remember to flip your model on the x-axis?
MagicaVoxel and Stonehearth has inverted x-axis (compared to the other).
Surely this is not the cause of all your struggles, but it’s a good thing to keep in mind in case you get to models that are not identical on all sides
Also, is the link in the first post updated according to your changes? Otherwise, would you mind sharing your current version?
Oh, this is just for the window, but you will know how to adapt it to the door, right? Just increase the y. I also added the collision box, you will need to remove it for the door, I guess.
Nothing, just needed some tweaks in the coordinates. Basically you need to make it able to rotate around its own center, and then shift it a little to the side., You can see this effect better by placing one with the debug on the ground, and clicking on the rotate button.