Created
November 29, 2012 02:42
-
-
Save Matheus-de-Souza/4166431 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Vector3 mousePosition = MouseUtils.ConvertMousePositionToWorldPosition(Input.mousePosition, | |
ScenarioData.MinPointToView, | |
ScenarioData.MaxPointToView); | |
public class MouseUtils { | |
public static Vector3 ConvertMousePositionToWorldPosition(Vector3 mousePosition, | |
Vector3 minPoint, | |
Vector3 maxPoint) | |
{ | |
mousePosition.x = ((mousePosition.x / (float)Screen.width) * (maxPoint.x - minPoint.x)) + minPoint.x; | |
mousePosition.y = ((mousePosition.y / (float)Screen.height) * (maxPoint.y - minPoint.y)) + minPoint.y; | |
return mousePosition; | |
} | |
} | |
public class ScenarioData | |
{ | |
public static Vector3 MaxPointToView = new Vector3( 14f, 14f, 0.1f); | |
public static Vector3 MinPointToView = new Vector3(-14f, -1f, -0.1f); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment