How to detect the specific pixel in a sprite3d that was clicked

Godot Version

Godot 4.6.2

Question

Currently trying to make code to draw over a canvas type object. The canvas is made up of a sprite3d with an ImageTexture over it, which I plan to modify and then re-apply every time it is drawn over. As of now I am kinda stuck on how I’d go on detecting what specific area of the sprite I’m drawing over, I thought of using a raycast3d created on click passing through to the canvas, but I couldn’t figure out how that would detect the specific position of the sprite or texture it collided with. Any idea how you’d go about it?

I’d take a look at the 4.7 feature DrawableTexture and see if it could be leveraged to solve your problem - whatever the actual problem you’re trying to solve.

3 Likes

Incredibly lucky for this to have been implemented not so long ago, will use this.

1 Like