#uv array not aligned with mesh vertices array (?)

1 messages · Page 1 of 1 (latest)

iron acorn
#

https://pastebin.com/9LtDHhWg

guys please help
i have code for generating a minecraft type chunk based on a 3d array of block data, then faces are positioned correctly but their normals and uv are scrambled and mixed up

ive narrowed it down to the generate mesh code itself and something to do with the uv array and the other arrays not matching up

#

as u can see all the faces are uv mapped, but theyre jumbled up

#

and the normal maps are all facing one direction , i tried recaculatenormals and nothing changes

#

int[] Blockdata = LoadBlock(x, y, z);
int loadblock checks the block at xyz and gives a 6 integar array of whether the 6 sides have faces and what their autotiled sprite tile is

#

i quadruple checked the rest of my script and im sure there are not problems outside the pastebin code

#

it is very unoptimsed right now but i just want to fix the uv mapping and normals problem ive been debugging for 5 hours im at my wits end

#

heres what a chunk of all bricks look like

iron acorn
#

i just noticed something

#

the jumbled pattern is repeating

#

how am i supposed to fix it ahhhhhh