Ray - "which face is hit?"-script

Hi

I need a script for use in the Game Engine to calculate which face was hit in the object returned by getHitObject()

I’ve tried different things with getHitNormal() and stuff to see if I could just get the hit normal and compare it with each of the normals of the faces of the object to see which 1 was hit. I don’t know if this is possible?

Any suggestions? Solutions?

umm, why?

see, you can find the hit location using a ray sensor, and the hit normal. This ought to be enough to seach through all of the faces for which one it was that was hit, but I don’t know what good this would do you… there isn’t really a lot you can do to the face once you’ve found it

what are you trying to do?

if you’re trying to change the vertex colors or vertex locations you’ll want to change them within a proximity of that point anyway… and well this will not change the collision hull…

armature-deformed meshes have similar and probably different issues too

so, what are you trying to do?

I need to do this because I’m making a game where I change the texture on the face that is hit by the ray. If a mesh has 5 faces and a ray hits 1 then the texture on that one face should be changed in the game. I know how to change the texture but not how to find the face hit by the ray.