So I followed the example at: http://sourceforge.net/p/irrlicht/patches/211/
scroll down some and you'll see the zip brush ent v2 thats what I'm following.
So I downloaded that and ran it and the door opens perfectly fine. I then tried to make a function out of it and use it in my own project.
Code: Select all
void CQuake3EventHandler::doorTest()
{
if (!Mesh )
{
printf("*****IQ3LevelMesh INVALID****\n");
return;
}
ISceneManager *smgr = Game->Device->getSceneManager();
tQ3EntityList &entityList= Mesh->getEntityList();
IEntity search;
IMesh *doormesh = 0;
search.name = "func_door";
// find all entities in the multi-list
s32 index = entityList.binary_search(search);
if (index >= 0) // Our level has only one door.
{
printf("BRUSH FOUND\n");
doormesh = Mesh->getBrushEntityMesh(entityList[index]);
}
if(!doormesh)
{
printf("NO BRUSHES FOUND RET\n");
return;
}
doorNode = smgr->addMeshSceneNode(doormesh);
//Always returns X: 0.00 Y: 0.00 Z: 0.00
printf("DOOR: X:%f Y: %f Z:%f\n", doorNode->getPosition().X, doorNode->getPosition().Y, doorNode->getPosition().Z);
}
Also, if I stop calling 'doorTest()' the doors disappear entirely and I've also tried to use other maps with the same result.
I made my own map with a door that is much larger than the example one. I then tested both the example map and the one I made in the example application. Both doors work perfectly.
But in my game all I can ever get is all 0's for the doors position? Am I doing something wrong?
EDIT: I'm loading doorTest() at the end of the LoadMap function and it correctly tells me if a map has brush entities or not. The only problem I seem to have is the position is all 0's.