Ok, I am throwing in the towel. I have been toiling over this for two days already, and I can’t, for the life of me, figure out what’s wrong. I am sure it is something quite stupid. Yet, I cannot fathom what it is. A picture is worth a thousand words so three follows:
Blocksize is 1.0f. Chunk Position is the ones in the picture. Block Position is the array index.
I can’t really fathom what is wrong. Could someone please help me?
protected override void meshUp (Chunk chunk, ref MeshData meshData)
{
float offset = blockSize / 2;
MeshPosition meshPosition = new MeshPosition (
chunk.position.x + this.position.x * Block.blockSize,
chunk.position.y + this.position.y * Block.blockSize,
chunk.position.z + this.position.z * Block.blockSize
);
meshData.AddQuadFromVertices (
new Vector3 (meshPosition.x - offset, meshPosition.y + offset, meshPosition.z + offset),
new Vector3 (meshPosition.x + offset, meshPosition.y + offset, meshPosition.z + offset),
new Vector3 (meshPosition.x + offset, meshPosition.y + offset, meshPosition.z - offset),
new Vector3 (meshPosition.x - offset, meshPosition.y + offset, meshPosition.z - offset)
);
this.meshUV(ref meshData, this.GetTexture (Direction.Up));
}