Hi,
i got inspired by some of the latest Blocksystems and stuff like:
http://hub.jmonkeyengine.org/forum/topic/simplebloxelworld-update1-new-features-new-video/
or
http://hub.jmonkeyengine.org/forum/topic/simple-voxel-engine-starter-kit/
Now with starting point of thoses projekt i wanted to try my own (with some sinippets of the projects above).
My problem at the moment is, that the Blocks are vanishing ins some camera angles and i don’t know why.
There are some other problems which could help to solve it.
When i add rigid bodies on start the player sinks into the first block.
Another thing ist that i use mouse picking and the ray does not colide with my mesh, but with the player (which is jme3 Box)
My first guess is a problem with normals.
Here is the setup of the upper face of my block (thx to moonkey and zzuegg ):
[java]
float bx, by, bz;
bx = position.x * blocksize;
by = position.y * blocksize;
bz = position.z * blocksize;
Vector3f pa = new Vector3f(bx - halfblocksize, by - halfblocksize, bz + halfblocksize);
Vector3f pb = new Vector3f(bx + halfblocksize, by - halfblocksize, bz + halfblocksize);
Vector3f pc = new Vector3f(bx - halfblocksize, by + halfblocksize, bz + halfblocksize);
Vector3f pd = new Vector3f(bx + halfblocksize, by + halfblocksize, bz + halfblocksize);
Vector3f pe = new Vector3f(bx - halfblocksize, by - halfblocksize, bz - halfblocksize);
Vector3f pf = new Vector3f(bx + halfblocksize, by - halfblocksize, bz - halfblocksize);
Vector3f pg = new Vector3f(bx - halfblocksize, by + halfblocksize, bz - halfblocksize);
Vector3f ph = new Vector3f(bx + halfblocksize, by + halfblocksize, bz - halfblocksize);
private Vector3f yAxis = Vector3f.UNIT_Y;
[…]
verticesSize = vertices.size();
vertices.add(pc);
vertices.add(pd);
vertices.add(pg);
vertices.add(ph);
normals.add(yAxis);
normals.add(yAxis);
normals.add(yAxis);
normals.add(yAxis);
Vector2f[] cords = NinePatch.getPatches(Patches.MiddleMiddle);
texCoord.add(cords[0]);
texCoord.add(cords[1]);
texCoord.add(cords[2]);
texCoord.add(cords[3]);
indexes.add(verticesSize + 2);
indexes.add(verticesSize + 0);
indexes.add(verticesSize + 1);
indexes.add(verticesSize + 1);
indexes.add(verticesSize + 3);
indexes.add(verticesSize + 2);
[/java]
And my first post here