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.
kimgar
Posts: 37 Joined: Fri Apr 13, 2007 2:53 pm
Location: norway
Post
by kimgar » Tue Mar 04, 2008 11:06 pm
Hi!
how change the material of a node? i wanted to swap between two materials, and was hoping that something like this would work:
Code: Select all
IAnimatedMesh* mesh = smgr->getMesh("../media/mesh/sydney.md2");
IAnimatedMeshSceneNode* node = smgr->addAnimatedMeshSceneNode( mesh );
node->setMaterialTexture( 0, driver->getTexture("../media/mesh/sydney.bmp") );
SMaterial blankMaterial;
node->setMaterial(0, blankMaterial);
...but obviously it doesn't, anyone know what i am missing?
kimgar
Posts: 37 Joined: Fri Apr 13, 2007 2:53 pm
Location: norway
Post
by kimgar » Tue Mar 04, 2008 11:32 pm
ah, it's been awhile
this works
vitek
Bug Slayer
Posts: 3919 Joined: Mon Jan 16, 2006 10:52 am
Location: Corvallis, OR
Post
by vitek » Tue Mar 04, 2008 11:34 pm
Is there any reason why you can't write
Code: Select all
node->getMaterial(0) = blankMaterial;
The
getMaterial() method returns a reference to the material, so the above code just assigns the material directly [assuming there is a material at index 0].
Travis
kimgar
Posts: 37 Joined: Fri Apr 13, 2007 2:53 pm
Location: norway
Post
by kimgar » Tue Mar 04, 2008 11:44 pm
no reason at all
it's amazing, i've been struggling for hours and finally gave up and had to ask here, then a minute later i figured it out - oh well, thanks anyway vitek!