Problem with animated model and collision.

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
nFec
Posts: 5
Joined: Thu Oct 12, 2006 5:43 pm

Problem with animated model and collision.

Post by nFec »

Hi,

i have read through many other threads concerning similiar topics, but none did exactley grasp my problem.

I know a lot of you prefer using newton or something similiar for this, but i just don't need a physics engine.
What i try to achieve is a simple block, rotating slowly.
In my whole program (ok it's just a main file after all ;)) i use oct-trees for collision detection.

Heres part of my code for this:

Code: Select all

mesh = smgr->getMesh("Segel_x.x");
    
    animatedNode = smgr->addAnimatedMeshSceneNode(mesh);
    
    animatedNode->setMaterialFlag(EMF_TRILINEAR_FILTER, true);
    animatedNode->setMaterialFlag(EMF_ANISOTROPIC_FILTER, true);
    animatedNode->setMaterialFlag(EMF_FOG_ENABLE, true);
    animatedNode->setMaterialType(EMT_TRANSPARENT_ALPHA_CHANNEL_REF);
    
    animatedNode->setAnimationSpeed(80);
	
	//collission
	node = smgr->addOctTreeSceneNode(mesh->getMesh(0));
    octTreeSelector = smgr->createOctTreeTriangleSelector(mesh->getMesh(0), node, 128);
    node->setTriangleSelector(octTreeSelector);
    metaTriangleSelector->addTriangleSelector(octTreeSelector);
    octTreeSelector->drop();
So what is the problem?

The problem is, that there now is one instance of this model standing still, but beeing used for collision detection, and one rotating through wich i can walk.
What i already tried is to add the node returned from smgr->addOctTree... as a child to the node that is animated. I did this cause i read childs are moved relative to their parents. Didn't work.

I get that these are different nodes so i get the problem, i just don't see how to do it in another way.

Im sure my brain is just stuck, and the solution is just pretty simple, but i don't get it.

Regards,
nFec
Acki
Posts: 3496
Joined: Tue Jun 29, 2004 12:04 am
Location: Nobody's Place (Venlo NL)
Contact:

Post by Acki »

What do you exactly want ???
Shall both nodes have collision ???
Than also create a triangle selector for the animated node and add it to the meta triangle selector...
while(!asleep) sheep++;
IrrExtensions:Image
http://abusoft.g0dsoft.com
try Stendhal a MORPG written in Java
Post Reply