-
-
Save seferciogluecce/b2c83468d159234057576ffdf9a44a44 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
if (Input.GetMouseButton(0)) //this changes for different approaches | |
{ | |
mousePos = (Input.mousePosition); | |
Vector2 targetPos= new Vector2(Camera.main.ScreenToWorldPoint(mousePos).x, Camera.main.ScreenToWorldPoint(mousePos).y); | |
targetPos.x = Mathf.Clamp(targetPos.x, MinPos.x, MaxPos.x); | |
targetPos.y = Mathf.Clamp(targetPos.y, MinPos.y, MaxPos.y); | |
transform.position = targetPos; //this changes for different approaches | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment