CloneDeath / MagicaVoxel-Importer-with-Extensions

A Godot plugin to import MagicaVoxel .vox files as meshes.
21 stars 6 forks source link

Y offset #2

Closed bamyazi closed 5 years ago

bamyazi commented 5 years ago

example.zip

I've had a problem with models not sitting at 0 in the y-axis. Seems to happen when you resize the magicavoxel grid size.

I had to modify the importer the offset the generated vertices by mins.z as follows

var offset = Vector3(0, -mins.z * scale, 0);

# Generate geometry
st.add_color(faces[face])
for vert in face_meshes[o]:
    st.add_vertex(offset + vox_to_godot.xform(((vert * grow) + face) * scale))
CloneDeath commented 5 years ago

Hmm. I didn't know you could change the scale in Magica Voxel (makes the import scale kinda redundant, but I'd still like to keep it).

If you could make a pull request with that change, and attach a simple *.vox file that reproduces the issue to this ticket, then I'd gladly test out your fix and accept it.

CloneDeath commented 5 years ago

Closing issue, since #4 fixes this