HI all,
I'm a complete noob, only started with Irrlicht today so I'm probably being stupid, anyway. I've built a world with a couple of cubes with mesh buffers which I've manually added to an SMesh object. I've added the resulting mesh to the world using the addMeshSceneNode method and created an FPS camera. I've also disbled lighting on the mesh if this makes any difference.
The world displays correctly when the camera is at certain angles yet suddenly clips at others, usually when looking away from the centre of the coordinate system. I've truied this using all 3 render engines yet still the same effect occurs.
Can anyone tell me what I'm doing wrong.
thanks in advnce for any help
Steve
wierd clipping issues
Thanks Nico
Disabling Culling does remove the problem. I tried recalculating the meshes bounding box using its own recalculateBoundingBox method and this has no effect.
As the IMeshManipulator is abstract, do I need to subclass this myself or is there an SMeshManipulator availible or something along those lines?
Disabling culling is obviously only a temp solution
Cheers
Steve
Disabling Culling does remove the problem. I tried recalculating the meshes bounding box using its own recalculateBoundingBox method and this has no effect.
As the IMeshManipulator is abstract, do I need to subclass this myself or is there an SMeshManipulator availible or something along those lines?
Disabling culling is obviously only a temp solution
Cheers
Steve
OK I've got aa mesh manipulator now and still no joy. Heres the code I'm using exclusing the function create Cube which simply adds vertices and indices to the mesh buffer mb (This I think is working as they do display correctly )
SMesh mesh;
array<SColor> col;
s32 i = col.size();
col.push_back(SColor(100, 0, 0, 0));
col.push_back(SColor(100, 255,0, 255));
col.push_back(SColor(100, 0, 255, 0));
col.push_back(SColor(100, 255,0, 255));
col.push_back(SColor(100, 0, 0, 255));
col.push_back(SColor(100, 0, 255,0));
col.push_back(SColor(100, 0, 255,255));
col.push_back(SColor(100, 0, 0, 255));
SMeshBuffer mb;
vector3df or(0, -250, 0);
createCube(&mb, or,5000,10,5000, col,0);
or.set(0,0,0);
createCube(&mb, or, 500,500,500, col,8);
IMeshManipulator *manip = smgr->getMeshManipulator();
manip->recalculateBoundingBox (&mb);
mesh.addMeshBuffer(&mb);
scene::ICameraSceneNode* camera ;
ISceneNode *node = smgr->addMeshSceneNode(&mesh, NULL, 1, vector3df(0,0,0));
manip->recalculateBoundingBox(mesh.getMeshBuffer(0));
node->setMaterialType(EMT_SOLID);
node->setMaterialFlag (EMF_LIGHTING , false);
//node->setAutomaticCulling(false);
scene::ITriangleSelector* selector = 0;
if (node)
{
//node->setPosition(core::vector3df(-1370,-130,-1400));
selector = smgr->createTriangleSelector(&mesh, node);
node->setTriangleSelector(selector);
selector->drop();
}
camera =
smgr->addCameraSceneNodeFPS(0,100.0f,300.0f);
camera->setPosition(core::vector3df(0,50,0));
camera->setNearValue(1);
camera->setFarValue(10000);
camera->setFOV(60.0/180 *3.14159);
camera->setAspectRatio(600/800.0);
scene::ISceneNodeAnimator* anim = smgr->createCollisionResponseAnimator(
selector, camera,
core::vector3df(30,50,30), //elipsoid
core::vector3df(0,-100,0), // gravity
100.0f, //acceleration
core::vector3df(0,50,0)); // eye position
camera->addAnimator(anim);
anim->drop();
ICursorControl *cur = device->getCursorControl();
cur->setVisible(false);
SMesh mesh;
array<SColor> col;
s32 i = col.size();
col.push_back(SColor(100, 0, 0, 0));
col.push_back(SColor(100, 255,0, 255));
col.push_back(SColor(100, 0, 255, 0));
col.push_back(SColor(100, 255,0, 255));
col.push_back(SColor(100, 0, 0, 255));
col.push_back(SColor(100, 0, 255,0));
col.push_back(SColor(100, 0, 255,255));
col.push_back(SColor(100, 0, 0, 255));
SMeshBuffer mb;
vector3df or(0, -250, 0);
createCube(&mb, or,5000,10,5000, col,0);
or.set(0,0,0);
createCube(&mb, or, 500,500,500, col,8);
IMeshManipulator *manip = smgr->getMeshManipulator();
manip->recalculateBoundingBox (&mb);
mesh.addMeshBuffer(&mb);
scene::ICameraSceneNode* camera ;
ISceneNode *node = smgr->addMeshSceneNode(&mesh, NULL, 1, vector3df(0,0,0));
manip->recalculateBoundingBox(mesh.getMeshBuffer(0));
node->setMaterialType(EMT_SOLID);
node->setMaterialFlag (EMF_LIGHTING , false);
//node->setAutomaticCulling(false);
scene::ITriangleSelector* selector = 0;
if (node)
{
//node->setPosition(core::vector3df(-1370,-130,-1400));
selector = smgr->createTriangleSelector(&mesh, node);
node->setTriangleSelector(selector);
selector->drop();
}
camera =
smgr->addCameraSceneNodeFPS(0,100.0f,300.0f);
camera->setPosition(core::vector3df(0,50,0));
camera->setNearValue(1);
camera->setFarValue(10000);
camera->setFOV(60.0/180 *3.14159);
camera->setAspectRatio(600/800.0);
scene::ISceneNodeAnimator* anim = smgr->createCollisionResponseAnimator(
selector, camera,
core::vector3df(30,50,30), //elipsoid
core::vector3df(0,-100,0), // gravity
100.0f, //acceleration
core::vector3df(0,50,0)); // eye position
camera->addAnimator(anim);
anim->drop();
ICursorControl *cur = device->getCursorControl();
cur->setVisible(false);