ISceneCollisionManager+Custom SceneNode (+Material question)

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
user-r3
Posts: 70
Joined: Tue Dec 07, 2010 4:09 pm

ISceneCollisionManager+Custom SceneNode (+Material question)

Post by user-r3 »

Hi, I'm sorry if the information I provide isn't enough, but I'm exhausted after searching my mistake... so please help me.

After reading this article
http://irrlicht.sourceforge.net/docu/example003.html
and this one
http://de.wikibooks.org/wiki/Irrlicht_- ... _verwenden
(German Wikibooks)

I created a Custom Scene node, CUnit, which inherits ISceneNode, just like the CWuerfel in the Second link.

It works fine to be displayed (and makes it ease for me to display a quboid and not a cube...)
but:

1.)
It is displayed with fancy colors (which are set in the example code), but I am not able to assign a material (png file) to it.

2.)
Before making that class I used ISceneCollisionManager 's function getSceneNodeAndCollisionPointFromRay
which doesn't select anything now...

So... which function or property do I have to set or add,...
could someone please help me?

If the provided information isn't enough, please tell me, but if you need source, the second link should be enough (though it's German)

Thanks!
Gorbstein
Posts: 37
Joined: Wed Nov 25, 2009 8:44 pm
Location: Scotland

Post by Gorbstein »

1.)
It is displayed with fancy colors (which are set in the example code), but I am not able to assign a material (png file) to it.
What is the problem? What code are you using to assign the png texture to the object? Should be something like:

mat->setTexture(0,<texture>)

<texture> being one you loaded previously with driver->getTexture(<filename>);


If you generate the vertices yourself you will also need to set texture coordinates for each and every vertex:

//Vorne
cwVertices[0] = S3DVertex(fMaxLinks, fMaxUnten, fMaxVorne,0,0,0,SColor(255,255,0,0),0,0); //Punkt A

the last 2 parameters 0,0 are your u and v tex coords.
Post Reply