Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Removed content

Discussion in 'Scripting' started by Erdroy, Dec 26, 2013.

  1. Erdroy

    Erdroy

    Joined:
    Jan 12, 2013
    Posts:
    19
    Removed content
     

    Attached Files:

    Last edited: Nov 17, 2019
  2. Erdroy

    Erdroy

    Joined:
    Jan 12, 2013
    Posts:
    19
    Ok, done!
     
    Last edited: Jan 6, 2014
  3. JohnnyA

    JohnnyA

    Joined:
    Apr 9, 2010
    Posts:
    5,039
    Check if any vert of the new box is inside the already placed boxes. Then check that none of the already placed boxes have verts inside the new box.

    Inside is pretty simple... if the x is >= Min.x and x <= Max.x and y is >= Min.y and y <= Max.y then the point is inside the box.

    I'm sure that could be optimised for example by sorting the boxes, but there's probably no need.