How Irrlicht Detects Collision Help?
How Irrlicht Detects Collision Help?
I've been reading the collision tutorial over and over, but I can't quite pinpoint the exact codes that allow the Irrlicht engine to detect a collision. I understand that they implement a "ray" that can detect the triangle polygons of an object and a enumerated constant that allows the ray to determine whether an object is "pickable", but other than that, I don't see how everything comes together.
Re: How Irrlicht Detects Collision Help?
Maybe check also documentation for ITriangleSelector: http://irrlicht.sourceforge.net/docu/cl ... ector.html
Basically the rays collide with those. ITriangleSelector is just an interface, Irrlicht does not care how it is implemented and has actually itself several different implementations with different characteristics. But in general triangleselectors have a copy of all triangles making up the meshes and are usually updated whenever the mesh changes. Special triangleselectors like OctreeTriangleSelector can optimize certain tasks - in this case for example collision to static meshes can be faster. Also metattriangleselectors allow merging different triangleselectors so they can be accessed through a single object.
Basically the rays collide with those. ITriangleSelector is just an interface, Irrlicht does not care how it is implemented and has actually itself several different implementations with different characteristics. But in general triangleselectors have a copy of all triangles making up the meshes and are usually updated whenever the mesh changes. Special triangleselectors like OctreeTriangleSelector can optimize certain tasks - in this case for example collision to static meshes can be faster. Also metattriangleselectors allow merging different triangleselectors so they can be accessed through a single object.
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
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
Re: How Irrlicht Detects Collision Help?
So is it safe for me to assume that the rays "collide" with the triangles when the ray length = 0 (distance from object to triangle)? If that's the case, I also take it that there are multiple rays that stream from the object that detects these polygons all around it? (so moving an object side to side and/or backwards can't slip through a wall)
Re: How Irrlicht Detects Collision Help?
Rays are just rays. When you talk about object collision you probably mean ISceneNodeAnimatorCollisionResponse: http://irrlicht.sourceforge.net/docu/cl ... ponse.html
This does not use rays at all but works with a ellipsoid-triangle collision instead. Basically it's working with ISceneCollisionManager::getCollisionResultPosition: http://irrlicht.sourceforge.net/docu/cl ... 71191aca23
Additionally it implements some collisions response (sliding along the collision plane). If you want more detail you can always take a look at the source (CSceneNodeAnimatorCollisionResponse.cpp/.h).
This does not use rays at all but works with a ellipsoid-triangle collision instead. Basically it's working with ISceneCollisionManager::getCollisionResultPosition: http://irrlicht.sourceforge.net/docu/cl ... 71191aca23
Additionally it implements some collisions response (sliding along the collision plane). If you want more detail you can always take a look at the source (CSceneNodeAnimatorCollisionResponse.cpp/.h).
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
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
Re: How Irrlicht Detects Collision Help?
Ah I see. So the Collision manager detects not only an object collision, but also a mesh collision at the same time. Additionally, there are multiple collision responses that can also be implemented.
Out of curiosity, is there a way for this collision type to distinguish a collision in the "front" or "back" (Head, body, leg, etc.)?
As always, thanks for the help.
Out of curiosity, is there a way for this collision type to distinguish a collision in the "front" or "back" (Head, body, leg, etc.)?
As always, thanks for the help.
Re: How Irrlicht Detects Collision Help?
For figuring out body-parts I would probably use invisible nodes which are around the real body and check for those.
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
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm