Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ///Check to make sure the object will not spawn on top of the player or another spawned object.
- private bool spawnPosIsLegal(Vector3 pos) {
- RaycastHit hit;
- if (Physics.Raycast(pos, Vector3.down, out hit) && hit.transform.CompareTag("Player"))
- return false;
- string hitName = hit.transform.name.Replace("(Clone)", "");
- for (int i = 0; i < objectsToSpawn.Length; ++i) { //Make sure not to spawn on top of a spawnable object
- if (hitName == objectsToSpawn[i].name)
- return false;
- }
- return true;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement