Call User Defined Function on 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
Deuce
Posts: 3
Joined: Fri Nov 16, 2007 5:48 am

Call User Defined Function on Collision

Post by Deuce »

If I want to call a user defined function assigned to a specific node when that node collides with something, how should I do that? It appears that the collision handler in the example tutorial only stops the node from moving, I would like to have some kind of an AI function called. :D
Deuce
Posts: 3
Joined: Fri Nov 16, 2007 5:48 am

Post by Deuce »

Only way I can think of doing this is set some identifier on the node (like setting the id or name) that tells what object class to call for processing.
JP
Posts: 4526
Joined: Tue Sep 13, 2005 2:56 pm
Location: UK
Contact:

Post by JP »

I don't think there's any way to do this in irrlicht as standard... Which is sort of strange as it would be very useful. But the collision detection in irrlicht isn't meant to be complete, it's just something to get you going i guess.

If you want something like this your best bet is probably to use a physics engine (it's not too complicated if you know your way around programming).

Other than that you could check collisions using the scenecollisionmanager every frame against all the nodes you're interested in and then basically that would set up your own collision detection as opposed to the collision animator and then you could call your callbacks depending on the nodes colliding.

Make any sense?
Image Image Image
Post Reply