- Home /
Clicked position on UI image
Newbie here. I would like to be able to determine the relative position clicked on a sprite placed on a UI canvas. For example, on a 1 x 3 rectangle I'd like to be able to determine which third was clicked to initiate a drag operation.
I've tried all sorts of screen-to-world, world-to-screen, etc. conversion, but I'm not seeing values that make sense to me. The scale of the sprites are as low as 32 pixels wide at the moment. I'm wondering if that would have an effect.
Any tips or advice would be helpful. Thanks
$$anonymous$$ore detail. I'm thinking I can use the difference between the mouse position and the image position, which both seem to be in screen coordinates. But I would need the relative size of the image in the same coordinate system to "lerp" the result. With no scaling, the size of the sprite see$$anonymous$$gly has no bearing on its width/height in screen space. Is there a way to translate this?