Sorry if that is the unsuitable place to ask this, please do inform me the place a query like that is higher requested.

Im importing a mannequin from one other sport into the online game minecraft, which makes use of a coordinate system the place a coordinate maps to a block on this planet. Ive scaled it accurately nearly as good as I can however every block (or set of eight vertices for every nook) are scaled unsuitable. That is exhausting to clarify however right here take this picture:

https://imgur.com/a/tE00E9F (2nd picture, scroll down)

The blocks which import to minecraft are scaled unsuitable, and the blocks vertices are the place the fence poles are within the mannequin (the poles within the fence are attempting to signify the set of vertices related within the mannequin proper now. So within the image above, in minecraft the width is 5 blocks, but it surely needs to be Four blocks as a result of If you happen to see the fence poles they present the outlines of the block which needs to be positioned. Ideally I wish to create the block at ONE of the corners of every fence pole (which represents a block), it doesnt matter the nook because the mannequin would nonetheless import, simply with a 1 offset relying on which vertex (backside left,backside proper,prime proper or prime left, + all of the others for the z coordinate…) the block is positioned at.

i.e, the left eight blocks within the image signify the eight vertices of the one block in the suitable:

https://imgur.com/a/tE00E9F (prime one, there are eight blocks on the left, though it appears 4. The vertices proper now are proper in the course of the blocks, after which they be part of as much as create the precise single block, however as a result of minecraft has a block coordinate at one of many corners of the block, this wont work and therefore locations on the block on the nook of the block. So I must type of needing to shift the vertices by 0.5 of a block to the the minecraft coordinate)

Since this doesn’t should be achieved quick, I simply loop although every vertex of the blocks that needs to be positioned and are within the mannequin, however place a block at every vertex as a substitute. Perhaps I’ve to group these vertices up? In that case, how would I do this with huge fashions?

I learn the vertices from a file right here, that is the loop proper now:

```
for(int x = 1; x <= vertCount; x++) {
float f = buf.readFloat();
p.verts.add(f);
}
```

If thats complicated (above), every vertex within the loop above will get grouped in threes. So when the loop variable x = 1, thats the x coord of the primary vertex, then y and z, then ‘new loop’ and so forth.. (A greater means would have been to retailer the x,y,z coordinates in arrays of three in a giant array)

So the issue is that im inserting blocks in minecraft on the vertices of the block that needs to be positioned.

(P.S, the vertices are in floats, however they’re complete numbers its just a few are smaller than a block and have decimal factors however I deal with that elsewhere, and I’d simply not import them if they’ve decimals ultimately)

That is the place I group the vertices:

```
int i=0;
quick index1; //cache the x
quick index2;//cache the y
for(quick x : faces){
if(i==1) {//this loop will get the x
index1=x;
i++;
proceed;
}else if(i==2) {//this lop will get the y
index2=x;
i++;
proceed;
}else {//this loop will get the z, additionally place the block right here too and begin amassing x,y,z once more
float pos1x = poly.verts.get(index1*3) /100;
float pos1y = poly.verts.get((index1*3)+1) /100;
float pos1z = poly.verts.get((index1*3)+2) /100;
float pos2x = poly.verts.get(index2*3) /100;
float pos2y = poly.verts.get((index2*3)+1) /100;
float pos2z = poly.verts.get((index2*3)+2) /100;
float pos3x = poly.verts.get(x*3) /100;
float pos3y = poly.verts.get((x*3)+1) /100;
float pos3z = poly.verts.get((x*3)+2) /100;
drawTriangle(pos1x,pos1y,pos1z,pos2x,pos2y,pos2z,pos3x,pos3y,pos3z);
i=1;
proceed;
}
}
```

Within the code above I am looping although every FACE (a set of three coordinates (just like the vertices checklist), inside an inventory of 16bit shorts to specify the indices within the vertices checklist that ought to join, so only a checklist of shorts grouped in units of three(x,y,z)).

The drawTriangle takes three factors and simply locations a block at every block inbetween the three corners of the face within the face (so a 3D triangle), because the mannequin im importing is simply numerous triangles which make a mesh. Nonetheless, this isn’t the place the issue is and I’d wish to type out the vertices earlier than this so the faces can draw utilizing the right block coordinates, not vertices.

The vertices is perhaps related to different vertices to kind different blocks aswell.

EDIT: The dividing of 100 scales the mannequin into blocks that are the identical dimension as minecraft. Additionally, the mannequin being imported is blocks, no circles, and so forth..