Quantcast
Channel: Latest Questions by karl_
Viewing all articles
Browse latest Browse all 90

Screen position orientation flipping

$
0
0

I'm trying to create a glowing orb that follows a user's finger when pressed down. It works well, but the Y axis is flipped. I figure that the screen position for the ipod is flipped from what the screen position is returned. (Top left of screen is 0, 480 for Input.MousePosition and 0, 0 for GUI.Layout). How can I write this to reflect the difference in Y values?

function OnGUI()
{
    if(Input.GetButton("Select"))
    {
        mousePos = new Vector3(Input.mousePosition.x, Input.mousePosition.y);
        Debug.Log("" + Input.mousePosition);
        GUI.Label (Rect(mousePos.x-64, mousePos.y-64, sizeOfImage.x, sizeOfImage.y), imageToDisplay);
    }
}

Viewing all articles
Browse latest Browse all 90

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>