How do I cancel the collision to choose?

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.

How do I cancel the collision to choose?

Postby comput » Mon May 28, 2012 8:05 pm

How do I cancel the collision to choose?

I created a collision to select the code is written so:

scene :: ITriangleSelector * sel = smgr-> createTriangleSelector (sceneNode-> getMesh (), sceneNode);
sceneNode-> setTriangleSelector (sel);
sel-> drop ();

I ask me how to cancel the collision Select and delete the scene node and release the memory?

I tried to write this, but memory is not freed, seems collision choices did not cancel.
node-> getTriangleSelector () -> drop ();
smgr-> addToDeletionQueue (node);
the mesh-> drop ();

May I ask how should I do, thank you!
comput
 
Posts: 8
Joined: Wed May 16, 2012 11:23 am

Re: How do I cancel the collision to choose?

Postby CuteAlien » Mon May 28, 2012 10:27 pm

The first line "node-> getTriangleSelector () -> drop ();" looks wrong (and dangerous - this should crash). The next one would be fine - just add hte node node to the deletion queue. Alternatively calling node->remove() would also work in most cases (happens immediate, which is sometimes good, but dangerous if the node is still needed). addToDeletionQueue is safer and removes it at the end of the frame.
mesh->drop looks wrong again (you should only drop if you created something with a function starting with the name "create").

Maybe you added your selector to a metatriangleselector? In that case you have to removed it there again.
IRC: #irrlicht on irc.freenode.net
My patches&stuff: http://www.michaelzeilfelder.de/irrlicht.htm
Games with Irrlicht: http://www.irrgheist.com/
News: http://www.reddit.com/r/irrlicht/
User avatar
CuteAlien
Admin
 
Posts: 5359
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany

Re: How do I cancel the collision to choose?

Postby comput » Tue May 29, 2012 4:57 pm

Thank you CuteAlien!
comput
 
Posts: 8
Joined: Wed May 16, 2012 11:23 am


Return to Beginners Help

Who is online

Users browsing this forum: Nadro and 1 guest

cron