Raycast texture color

Hi @hhoria,

There isn’t a built in way to do that, I can think of two ways in doing that:

  1. One is as you said to get the UV coordinates on the picked point, here is a helpful post on the subject:

And this example does something similar to paint damage: https://developer.playcanvas.com/en/tutorials/character-damage-demo/

  1. The other way would be to read pixels from the frame buffer at the 2D coordinates of the mouse click and get directly the pixel color. Similar to what the pc.Picker class does to pick models.

Note though that this method has a performance hit since it stalls the GPU while the CPU reads the pixels.

https://developer.playcanvas.com/en/tutorials/entity-picking/#frame-buffer-picking