bevy_vox_mesh icon indicating copy to clipboard operation
bevy_vox_mesh copied to clipboard

Models are flipped on the x-axis

Open Utsira opened this issue 1 year ago • 1 comments

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

Utsira avatar Jan 04 '24 20:01 Utsira

I would gladly accept a pull request to fix this!

Game4all avatar Jan 04 '24 21:01 Game4all