IMeshTriangleSlector losing the Reference Countable

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
PhGodinho
Posts: 6
Joined: Tue Oct 25, 2011 1:48 am

IMeshTriangleSlector losing the Reference Countable

Post by PhGodinho »

Guys, im using an IMetaTriangeSeletor to add colision in my scene, the next two calls are working well:

Code: Select all

 
        ISceneNode *cuboo = smgr->addCubeSceneNode(10.0f,NULL,-1,core::vector3df(140,120,-40));
        scene::ISceneNodeAnimator *animm = smgr->createCollisionResponseAnimator(WorldColisions, cuboo,core::vector3df(5,5,5), core::vector3df(0,-0.1f,0));
        cuboo->addAnimator(animm);
 
        ISceneNode *cubooo = smgr->addCubeSceneNode(10.0f,NULL,-1,core::vector3df(140,120,-40));
        scene::ISceneNodeAnimator *animmm = smgr->createCollisionResponseAnimator(WorldColisions, cubooo,core::vector3df(5,5,5), core::vector3df(0,-0.1f,0));
        cuboo->addAnimator(animmm);
 
The "WorldColisions" there is my IMetaTriangleSelector, when i debug and put breakpoint near these call the WorldColisions has these values:

- WorldColisions value:0x101b4794
- -irr::IReferenceCounted0 value: {DebugName=0x1008aac0 "AÃÌÌÌÌÌÌÌÌÌÌÌÌU‹ìQÇ@kÇ@<dýÇ@(ðîÇ@," ReferenceCounter=268503232 }

There are more values nested, but the Reference Counted is the one im focusing at

Here comes the problem, when i create a new Object in my game it must collide with the scenario, for this purpose i call this function:

Code: Select all

 
bool IrrWolforce::IrrEngineStrategy::AddSceneCollision( GameObject *node )
{
        //////////// MY ENGINE RELATED STUFF
        // get IrrGameObjectImpl to give access to ISceneNode
        // ONLY DO THIS KIND OF THING (get members exclusive from irrlitch) INSIDE IRRWOLFORCE!
        ISceneNode * irr_node =  ((IrrGameObjectImpl*)node->getImplementor())->node;
        /////////////////////////////////////////////////////////////////////////////
 
        scene::ISceneNodeAnimator *anim = smgr->createCollisionResponseAnimator(WorldColisions, irr_node,core::vector3df(5,5,5),core::vector3df(0,-0.5,0));
        
        irr_node->addAnimator(anim);
 
        return true;
}
At this point the value of WorldCollisions simple changes to:
WorldColisions value: 0x002f7410
-irr::IReferenceCounted value: {DebugName=0x00000000 <Bad Ptr> ReferenceCounter=5 }

My object keeps the gravity but does'nt collide with anything...
mongoose7
Posts: 1227
Joined: Wed Apr 06, 2011 12:13 pm

Re: IMeshTriangleSlector losing the Reference Countable

Post by mongoose7 »

- -irr::IReferenceCounted0 value: {DebugName=0x1008aac0 "AÃÌÌÌÌÌÌÌÌÌÌÌÌU‹ìQÇ@kÇ@<dýÇ@(ðîÇ@," ReferenceCounter=268503232 }
This doesn't look like utter rubbish to you? Probably you have 268,503,232 nodes in your scene? Are you using the right DLLs?
CuteAlien
Admin
Posts: 9983
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Re: IMeshTriangleSlector losing the Reference Countable

Post by CuteAlien »

Pretty impossible to see from those few lines what is going on in your application. Try to reduce your crash to a short reproducible example which we can compile then we can try and help.
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
Post Reply