Change face color

is it possible to change the color or opacity of a face that is hit by a ray?

Yep. I usually use an animation curve to change the RGB values.

Yes, it is possible, you need to set the Object Color in the object material and go to the object tab there is an object color panel, changing the color you can insert keys on this tab with the right mouse button and record an animation to change the color and transparency and then play it as an animation

But how can i relate the animation with raycast?

Use double mesh - body its mesh number1, face mesh number2 and detect ray collision in face mesh or use hitboxes for detect collision and play alpha-color animation -
start = own.worldPosition
end = face_mesh.worldPosition
ray = own.rayCast(end, start, 0, ‘face’)
hit = ray[0]
pos = ray[1]
if hit:
if ‘face’ in hit:
hit.playAction(“Face_Color”, 0, 100, blendin=5, layer =1)
hit.playAction(“Face_Alpha”, 0, 100, blendin=5, layer =1)

1 object per polygon is quite a time and performance waster.

I need to change the color of a single face of the mesh that get hit by ray, not the entire mesh.

Then you need to draw on the texture or draw on the vertices of the mesh, I can’t find this example right now, but if I find it, I’ll post it for you

As practice shows, there are no-there are examples when a unit is looking for a path to the goal while coloring the vertices of the mesh, while the FPS is at 50 frames, but this is a coloring of the entire path traveled - and here you need to color a small part

If one setup predefined paths for all objects you would also need to take into account LODs.

so i see next solutions - painting in texture model another texture, or method coloring vertex models and not use LOD system or use LOD in high distance for near distance look coloring faces models

Texture-Bump-Paint.7z (811.9 KB) Maybe this variant help coloring model face