vendredi 1 juin 2018

Moving a object randomly without it being inside a wall - Unity 5

i am trying to make some types of pickups spawn inside a given area, although some usually get stuck within the walls, how would i fix this?

Code in question for moving objects

  for (int x = 0; x < garbage.Length; x++) 
     {
         if (x < 5)
         {
             garbage[x].transform.position = new Vector3(Random.Range(-33.0f, 30.0f), 2.35f, Random.Range(30.0f, -35.0f)); 
         }
     }




Aucun commentaire:

Enregistrer un commentaire