I'm working in a project and i need to create a complete newton physic scene from a .irr file created by irrEdit ... I was able to extract each node from the scene, but "ISceneNode::getMesh()" is not working anymore (in earlier versions of Irrlicht was present if I am right)
I tried some examples, but many are outdated (although the examples work fine with old functions, but does not help
the code is something like this...
Code: Select all
AppSceneManager->loadScene("level.irr");
core::array<scene::ISceneNode *> nodes;
AppSceneManager->getSceneNodesFromType(scene::ESNT_ANY, nodes);
for (u32 i=0; i < nodes.size(); ++i){
scene::ISceneNode * node = nodes[i];
NewtonCollision* nmapcollision = NewtonCreateTreeCollision(AppWorld, NULL);
NewtonTreeCollisionBeginBuild(nmapcollision);
// This throws the following error in VisualStudio 2008
// error C2039: 'getMesh' : is not a member of 'irr::scene::ISceneNode'
scene::IMesh *mesh = node->getMesh();
for(u32 cMeshBuffer=0; cMeshBuffer<mesh->getMeshBufferCount(); cMeshBuffer++){
mb = mesh->getMeshBuffer(cMeshBuffer);
S3DVertex2TCoords* mb_vertices = (S3DVertex2TCoords*)mb->getVertices();
u16* mb_indices = mb->getIndices();
// add each triangle from the mesh
for (j=0; j<mb->getIndexCount(); j+=3){
// ...
}
}
NewtonTreeCollisionEndBuild(nmapcollision, 0);
NewtonBody* nmapbody = NewtonCreateBody(AppWorld, nmapcollision);
}