I have this problem, and I don't know what is the cause. When I create terrain in game and try to explore it, terrain is vanishing depending on camera angle, as you can see in video below. Everything is fine when I load world created from Esenthel Editor.
if(Game.World.settings().environment) // if the world has environment settings (like sun, ambient, sky, ..)
Game.World.settings().environment->set(); // then set them
// adjust mesh scale and position
flt scale=128;
Vec pos (128*x, 0, 128*y);
mesh.scaleMove(scale, pos);
// simplify the mesh
mesh.setBase ( ); // set software version needed for simplification and later physical body creation
mesh.simplify (0.05, 0); // simplify
mesh.setRender( ); // set rendering version from software version
// create physical body
MeshBase base;
base.createPhys(mesh);
base.simplify(0.05, 0); // create a 1 MeshBase from all MeshParts in mesh and simplify it again
phys .createMesh(base); // create physical body from that MeshBase
mesh.delBase(); // mesh software version is no longer needed
if(Kb.bp(KB_ESC))StateMenu.set(1.0); // when escape pressed set 'StateMenu' with 1.0 second smooth fading
if(Kb.bp(KB_F10 ))
Renderer.screenShots("Screenshot/","png");
Cam.transformByMouse(0.1, 10, CAMH_ROT|CAMH_ZOOM);
Cam.dist=Max(1.0, Cam.dist*ScaleFactor(Ms.wheel()*-0.1)); // update camera distance according to mouse wheel
Cam.setSpherical(Players[0].ctrl.center()+Vec(0, 1, 0), Players[0].angle.x, Players[0].angle.y/2.0, 0, Cam.dist);
bSky.update();
//UpdateCamera ();
Water.update(Vec2(0.01, 0.01));
Game.World.update(Cam.at); // update the world to given position
return true;
}
void Render()
{
Game.World.draw(); // draw world (this is done outside of 'switch(Renderer())' because world automatically detects active rendering mode)
}
Looks like you're area meshes have no (or incorrect) bounding boxes, which is what EE uses to frustum cull them away. Perhaps try calling mesh.setBox(true) to recalculate the mesh's bounding box after creating it and see if that solves the problem.
you're adding a Mesh to a MeshGroup, 'MeshGroup' has its own box, so call Game::World.areaActive(VecI2(x, y)).getData().mesh.setBox..
after adding the mesh.
Sadly adding setBox (as in Esenthel suggestion) didn't change anything. But thanks for giving me clue, I'll try something by myself and I'll post the result later.
(This post was last modified: 01-17-2015 09:40 AM by Pherael.)
Well, after few hours I couldn't figure it out. Knowing my luck I'm missing something simple. As see in video below, terrain have correct bounding boxes, but the problem still occurs.
If you can't figure out what's wrong, could you provide a small reproducible test case (a small *.EsenthelProject). It would be easier to pinpoint the issue.
Did you find a solution to this Pharael cause i've been searching my self and whatever i try has the same disappearing problem.
Let me know if you don't have a solution so i can post a much smaller project that might make it easier for other ppl to check.
(This post was last modified: 01-26-2015 11:54 PM by georgatos7.)
Lolol i found the problem while i was packing the project.
Just make sure you set the world area size (not resolution) to 128 while you create it and it'll work fine. :O
The world you are loading is using size 64 not 128 like you scale your meshes to, hence why it cuts out early. and only in certain occasions, either change the scale code to 64 or create a new world of size 128.
Seems I was a bit late
(This post was last modified: 01-27-2015 01:03 AM by Zervox.)
In the Editor you can check the area size using the "cursor position information" and moving the cursor to the edge of an area and investigating the position.
There is no way currently to check the heightmap resolution though, this needs to be done in code.