- Home /
get mouse position from specific sprite pixel?
convert sprite pixel to mouse position? any one any idea. share with me.
Answer by misher · Jan 30, 2019 at 08:40 AM
Get the position of the pixel in the 2d texture, use the sprite transform to calculate the world position, having the world position you can easily obtain the screen position. I'm not sure what do you mean by "mouse position", but if you want to move the cursor programmatically, it's not a trivial problem and it can be resolved specifically for a given platform please refer to https://answers.unity.com/questions/9408/set-cursor-position.html
i have specific pixel values of sprite and the sprite pivot set as bottom left. when i instantiate text mesh on specific pixel of sprite then i change the pixel values from screen to world point but it didn't get the right position. when i get the static mouse position and convert the position from screen to world point then it get the right position as you saw in the screenshot. 1 instantiate on the mouse position. so now i want to convert the specific sprite pixel to mouse position and then convert mouse position to screentoworldpoint which get me the exact position. hope fully now you better understand that what i want.
Your answer
Follow this Question
Related Questions
How to find out which object is under a specific pixel 1 Answer
Pixel Perfect 2D Polygon Collider 2 Answers
2D how to make a sprite follow the mouse position #c 2 Answers
Rotate sprite to face direction of movement 1 Answer
Change sprites colours individualy ( flashing like mario with the star ) 4 Answers