Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public int spawnPoints = 30;
- public GameObject spawnLocation;
- void Awake()
- {
- RaycastHit hit;
- for(int i=0;i<spawnPoints ;i++)
- {
- Vector3 position = new Vector3(Random.Range(-100.0f, 100.0f), 0, Random.Range(-100.0f, 100.0f));
- if (Physics.Raycast (position + Vector3 (0, 500.0f, 0), Vector3.down, out hit, 200.0f)) {
- Instantiate (spawnLocation, hit.point, Quaternion.identity);
- } else {
- Debug.Log ("there seems to be no ground at this position");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement