Game4all / bevy_vox_mesh

A bevy engine plugin for loading magica voxel files directly in bevy as usable meshes.
MIT License
32 stars 8 forks source link

Models are flipped on the x-axis #13

Open Utsira opened 10 months ago

Utsira commented 10 months ago

If you compare how an asymmetrical model appears in MV with Bevy, when loading via bevy_vox_mesh, the model is flipped on the x axis.

eg: the monu1 model that ships with MagicaVoxel as viewed in MV:

image

Same model in bevy:

image

I believe the fix for this is to change the linearisation in voxel.rs lines 35-37 to:

        let index =
            model_shape.linearize([model.size.x - voxel.x as u32, voxel.z as u32 + 1, voxel.y as u32 + 1])
                as usize;

this seems like the right place to flip the x axis, as this is where the Y and Z axes get swapped

Game4all commented 10 months ago

I would gladly accept a pull request to fix this!