Created
December 23, 2020 21:56
-
-
Save Hellhackee/ed2032def461973eeeba648ddd158172 to your computer and use it in GitHub Desktop.
RayBox Test
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
private void Update() | |
{ | |
Vector2 startCursorPosition = Vector2.zero; | |
if (Input.GetMouseButtonDown(0)) | |
{ | |
startCursorPosition = new Vector2(Input.mousePosition.x, Input.mousePosition.y); | |
} | |
if (Input.GetMouseButton(0)) | |
{ | |
if (startCursorPosition != Vector2.zero) | |
{ | |
Vector2 currentCursorPosition = new Vector2(Input.mousePosition.x, Input.mousePosition.y); | |
Collider2D[] rays = Physics2D.OverlapBoxAll(startCursorPosition, currentCursorPosition, 0); | |
Debug.DrawRay(new Vector3(startCursorPosition.x, startCursorPosition.y, 0), new Vector3(currentCursorPosition.x, currentCursorPosition.y, 0), Color.red); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment