Triangle Selector

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Post Reply
JustMax
Posts: 7
Joined: Sat Nov 10, 2007 10:26 pm
Location: Germany

Triangle Selector

Post by JustMax »

Hi

I have a problem with the Triangle Selectors. Every time I try to create one its simply empty. Have I misunderstood or forget something?

Code: Select all

        IAnimatedMesh* mesh = drivers->smgr->getMesh("models/fighter/fighter.3DS");

        IAnimatedMeshSceneNode* node = drivers->smgr->addAnimatedMeshSceneNode( mesh , 0, id);

        ITriangleSelector* s = drivers->smgr->createTriangleSelector(mesh, node);
        node->setTriangleSelector(s);

#ifdef FULLDEBUGINFO
        GameLog("%i    %i",drivers->smgr->getMeshManipulator()->getPolyCount(mesh),
                      s->getTriangleCount()); //output:"468    0"
#endif

        allUnitTriangeles->addTriangleSelector(s);
        s->drop();
This should be all the relevant source code.
if(Hell.isFrozen())
{
...
rogerborg
Admin
Posts: 3590
Joined: Mon Oct 09, 2006 9:36 am
Location: Scotland - gonnae no slag aff mah Engleesh
Contact:

Post by rogerborg »

Instead of this:

Code: Select all

ITriangleSelector* s = drivers->smgr->createTriangleSelector(mesh, node); 
I'd suggest getting an explicit IMesh* from your IAnimatedMesh* like this:

Code: Select all

ITriangleSelector* s = drivers->smgr->createTriangleSelector(mesh->getMesh(0), node); 
Please upload candidate patches to the tracker.
Need help now? IRC to #irrlicht on irc.freenode.net
How To Ask Questions The Smart Way
JustMax
Posts: 7
Joined: Sat Nov 10, 2007 10:26 pm
Location: Germany

Post by JustMax »

big thanks ;-) it works now.
if(Hell.isFrozen())
{
...
rogerborg
Admin
Posts: 3590
Joined: Mon Oct 09, 2006 9:36 am
Location: Scotland - gonnae no slag aff mah Engleesh
Contact:

Post by rogerborg »

n/p. IAnimatedMesh has been changed to be derived from IMesh. It wasn't always that way, and the behaviour when you pass an IAnimatedMesh* as an IMesh* isn't what you might expect. This is catching a lot of people out.
Please upload candidate patches to the tracker.
Need help now? IRC to #irrlicht on irc.freenode.net
How To Ask Questions The Smart Way
Post Reply