Call User Defined Function on Collision
Call User Defined Function on Collision
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.
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?
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?