detect when collision has happened
detect when collision has happened
hi.I have already applied collision to an .irr scene and it's working fine,the camera collides with all the objects etc.Now i want to display something when the camera collides with any of the objects. getCollsionPoint(line3d<f32>, selector, ..,..) which can return true but i dnt knw how to use the "line3d". I don't knw if there is any other method to knw if collision has occured. 
Irrlicht's primative collision detection by itself cannot tell the difference between objects it bumps into.
Casting ray's is a possible solution, but you would have to be casting a ray in the direction that the model hits the other object to know that it hit the object, so depending on the size of objects you're 'bumping' into, you may or may not be able to do this.
If your objects are large, you may be able to get away with casting 8 rays out from the center of the camera, and you could even have some of the rays go up and down. It might look something like this (top down view)
Don't mind the '.'s they're just to space out the 'drawing'. The lines represent the Rays cast out of your camera, just imagine those going around the center of your camera, and you could adjust the Y coordinates on them to make them point up and down, so you can find other stuff you bump into. The problem is that really small objects, or corners, might not get picked up with the rays because they may fit between the rays. This problem may be eliminated by using more rays, but you'll probably start to see a performance hit if you're casting too many rays (although it will depend on the system your program is running on).
You should probably look into using a Physics library like Newton, Bullet, ODE, or even PhysX. I believe they have the ability to know what has collided with what.
Casting ray's is a possible solution, but you would have to be casting a ray in the direction that the model hits the other object to know that it hit the object, so depending on the size of objects you're 'bumping' into, you may or may not be able to do this.
If your objects are large, you may be able to get away with casting 8 rays out from the center of the camera, and you could even have some of the rays go up and down. It might look something like this (top down view)
Code: Select all
....|
..\.../
---...---
../...\
....|You should probably look into using a Physics library like Newton, Bullet, ODE, or even PhysX. I believe they have the ability to know what has collided with what.