I was wondering if anyone ever try to use jiglib for triangle picking and if you gave me some hints on how proceed.
I assume you want to pick a triangle in a model mesh as in this demo.
You can pick a triangle with jiglibx, provided your models are part of a physics object and fit inside a collisionskin. This because the physics only cares about skins, not the models.
So if your models do all fit inside a collision skin, you can use SegmentIntersect() to see what skin you are picking. You can create a Segment the same way you would create a picking ray in most picking tutorials.
Once you have the CollisionSkin, you can look up the owning Body and once you have the body you can look up the model and use Intersection.SegmentTriangleIntersection() to check each triangle in the mesh.
From what I've seen (haven't quite done it myself) it's relatively straightforward to do triangle picking from scratch. You can use your model's mesh with raycasting.
It also depends on what your end goal. I didn't bother with it since it was easier to render models with their own unique colour to a rendertarget then use that for pixel-perfect selection.
I'm trying to get a decal which is not really a tyriangle picking but I need to access to the triangle to set the decal at this position.
I guess I need to investigate a bit more to find out if I can use jiglibX for this technique.
Unless your TriangleMesh collision skin matches your model exactly, I doubt JigLib is the answer here.
Are you doing something similar to bulletholes in walls? If so, my thinking is that it's not unreasonable for your level geometry to match your collision skin geometry, provided it's limited to walls, ground, etc. Detailed objects such as fire hydrants or pipes aren't normally part of the basic level geometry and are instanced objects added at runtime. Those objects tend to have a lower detail collision skin, or even just use primitives. This would be why you don't normally see weapon damage on doodads.
If you're trying to damage something like a player model, you're going to have to do some sort of high detail collision test outside of jiglib. This is fairly simple, just do a ray test on your model mesh. There's some examples on the XNA site.
What you said is kind of weird. Maybe I miss something. I want to retrieve the polygon position or indice in a mesh, it's suppose to be a level, a triangle mesh and yes it have to match to actual mesh.
I was thinking jiglibX collision system would be a better option than using some other method. I Can create a secondary collision system ( I want to create bullet hole) to hold all the level and let the dynamic one aside. Also I can split innto active zone using bounding box contains or someting alike to sort collision which aren't necessary.
Do you think it would kill my framerate ?
Basic raytesting against a mesh is fairly quick. To optimise it further, you can use an oct-tree. JigLib can do all this for you. Since you're testing a static object, you can use JigLib.
The only time you wouldn't use JigLib for this is if your collision skin doesn't match your mesh exactly, or your object you're testing is moving. That's because moving objects won't be oct-tree optimised as that's not something you'd rebuild every frame.
The point is, in this case you can use JigLib to extend the collision event and return the triangle and the world point that your ray intercepted it. You can translate this to screen space then back to texture coordinate space from there I think. Complicated stuff though. Once you identify the triangle and the collision location, you'd be better off taking this discussion to GameDev.net.