Skip to content

Instantly share code, notes, and snippets.

@Hellhackee
Created December 23, 2020 21:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Hellhackee/ed2032def461973eeeba648ddd158172 to your computer and use it in GitHub Desktop.
Save Hellhackee/ed2032def461973eeeba648ddd158172 to your computer and use it in GitHub Desktop.
RayBox Test
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