[Closed] Picking a face on a non selected object?
I want to pick a face on a non-selected object by clicking at it. The object can be a mesh.
I know what object it is so I can have it assigned to a variable, but it’s not selected
2 options:
- use IntersectRay. I think this would work, but I’m not sure how to construct the ray that I need to shoot. I recall seeing a help script for this a long time ago, but can’t find it now.
- Use the Paint tool. Unfortunately I think the paint tool only works if the object is selected correct? So looks like this won’t work.
So, repeat: I only want to select a face on an object (i know what object), but the object is not selected. it is probably a mesh object.
(This would let me do another speedincrease of hmm 10x i think!)
/Andreas
Getting the ray you need is actually quite simple:
mapScreenToWorldRay mouse.pos
If it’s a mesh object, an intersectRayEx will work fine. If it’s an epoly, however, you’ll need to also do a lookup to find which polygon contains the face that intersectRayEx returns the index of. The method I use is to get the face’s verts, collect all the polys using each of those verts, and single out which of them uses all three verts.
RH