Skip to content

Commit 0a9581b

Browse files
committed
Merge pull request #2 from barraudf/master
Fixed the default centered origin
2 parents e91748c + ec8eb29 commit 0a9581b

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

Assets/MagicaVoxel/Scripts/MVImporter.cs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -589,9 +589,9 @@ public static GameObject CreateGameObject(Transform parent, Vector3 pos, string
589589
public static GameObject[] CreateIndividualVoxelGameObjectsForChunk(MVVoxelChunk chunk, Color[] palatte, Transform parent, Material mat, float sizePerVox)
590590
{
591591
Vector3 origin = new Vector3(
592-
sizePerVox * chunk.sizeX / 2,
593-
sizePerVox * chunk.sizeY / 2,
594-
sizePerVox * chunk.sizeZ / 2);
592+
(float)chunk.sizeX / 2,
593+
(float)chunk.sizeY / 2,
594+
(float)chunk.sizeZ / 2);
595595

596596
return CreateIndividualVoxelGameObjectsForChunk(chunk, palatte, parent, mat, sizePerVox, origin);
597597
}
@@ -628,9 +628,9 @@ public static GameObject[] CreateIndividualVoxelGameObjectsForChunk(MVVoxelChunk
628628
public static GameObject[] CreateVoxelGameObjectsForChunk(MVVoxelChunk chunk, Color[] palatte, Transform parent, Material mat, float sizePerVox)
629629
{
630630
Vector3 origin = new Vector3(
631-
sizePerVox * chunk.sizeX / 2,
632-
sizePerVox * chunk.sizeY / 2,
633-
sizePerVox * chunk.sizeZ / 2);
631+
(float)chunk.sizeX / 2,
632+
(float)chunk.sizeY / 2,
633+
(float)chunk.sizeZ / 2);
634634

635635
return CreateVoxelGameObjectsForChunk(chunk, palatte, parent, mat, sizePerVox, origin);
636636
}
@@ -664,9 +664,9 @@ public static GameObject[] CreateVoxelGameObjectsForChunk(MVVoxelChunk chunk, Co
664664
public static Mesh[] CreateMeshesFromChunk(MVVoxelChunk chunk, Color[] palatte, float sizePerVox)
665665
{
666666
Vector3 origin = new Vector3(
667-
sizePerVox * chunk.sizeX / 2,
668-
sizePerVox * chunk.sizeY / 2,
669-
sizePerVox * chunk.sizeZ / 2);
667+
(float)chunk.sizeX / 2,
668+
(float)chunk.sizeY / 2,
669+
(float)chunk.sizeZ / 2);
670670

671671
return CreateMeshesFromChunk(chunk, palatte, sizePerVox, origin);
672672
}

MagicaVoxel.unitypackage

443 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)