[fixed in trunk] getCollisonNode() fail in IMetaTriangleSel
Posted: Sun May 05, 2013 12:53 pm
Hi there.
short:
The getCollisonNode() seem only seem able to parse the first TriangleSelector added to the IMetaTriangleSelector
What to do, am i doing stuff wrong?
Elaborated:
I would like to have a some static nodes to respresent my level/world and some movable nodes.
To get collision detection i create TriangleSelector for all nodes of the level. The smartest way is of course to gather these in a IMetaTriangleSelector
Afterward a CollisionResponse animator is added to my Moveable node
The basic animation works. The moveable nodes are stopped by the static nodes of the level.
However in some case i would like to use a callback mechanism. (e.g. some damage might occur if a truck hit a heavy rock)
For these cases i would like to use getCollisionNode
However IMetaTriangleSelector parse the first node, no mater swich node i collide with
So far my best option would be to create a seperate animation for each of the staic level nodes.
short:
The getCollisonNode() seem only seem able to parse the first TriangleSelector added to the IMetaTriangleSelector
What to do, am i doing stuff wrong?
Elaborated:
I would like to have a some static nodes to respresent my level/world and some movable nodes.
To get collision detection i create TriangleSelector for all nodes of the level. The smartest way is of course to gather these in a IMetaTriangleSelector
Code: Select all
IMetaTriangleSelector* assembledTriangles = smgr->createMetaTriangleSelector();
ITriangleSelector* staticTriSelector= smgr->createTriangleSelector(myStaticNode->getMesh(),myStaticNode);
ITriangleSelector* staticTriSelector2= smgr->createTriangleSelector(myStaticNode2->getMesh(),myStaticNode2);
assembledTriangles->addTriangleSelector(staticTriSelector2);
assembledTriangles->addTriangleSelector(staticTriSelector);
Code: Select all
ISceneNodeAnimatorCollisionResponse* Anim_collition = smgr->createCollisionResponseAnimator (assembledTriangles,Node2Move, core::vector3df(5,5,5),gravity, core::vector3df(0,0,0));
Node2Move->addAnimator(Anim_collition);
However in some case i would like to use a callback mechanism. (e.g. some damage might occur if a truck hit a heavy rock)
For these cases i would like to use getCollisionNode
Code: Select all
class MyColCallback:public ICollisionCallback {
virtual bool onCollision( const ISceneNodeAnimatorCollisionResponse & animator ) override
{
ISceneNode* Node = animator.getCollisionNode();
std::cout<< "Callback msg. Collision with" << Node->getName() <<std::endl;
return false;
}
};
MyColCallback aCallBackClass;
Anim_collition->setCollisionCallback(&aCallBackClass)
So far my best option would be to create a seperate animation for each of the staic level nodes.