Just wondering, is there a script to place lets say 8 models on slopes randomly? Like, if the slope is over 10 degrees, places X models randomly. Have a ton of rock to place and would like a more simple way of doing it. This is in the editor also, just click it, run it and it goesthen done.
I have the angles etc, I just was wondering if there is something out there like a script that you enter your models and it will place them. For instance, I need these pathways (Screenshot - c0df73f5cc40d8b0cbce522a298b5f17 - Gyazo) covered with rocks on the walls, instead of placing them one by one, a script that places tem for me once and iām done.
using UnityEngine;
using System.Collections;
public class PlaceRandomModel : MonoBehaviour {
public GameObject[] models;
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update ()
{
Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);
RaycastHit hit;
if(Input.GetMouseButtonDown(0))
{
if(Physics.Raycast(ray, out hit, Mathf.Infinity))
{
int index = Random.Range(0, models.Length);
GameObject clone = (GameObject)Instantiate(models[index], hit.point, Quaternion.identity);
clone.transform.up = hit.normal;
}
}
}
}
I use MegaScatter for this sort of thing, allows me to define areas to scatter into, use height limits to define regions or slope angles to scatter on to, saves me a ton of time building my levels, plus I can change the settings and re scatter depending on the platform and also the biggest feature for me is being able to scatter at runtime which took my mobile apps memory size down by over 100MB.
sorry didnāt mean to offend you.
youāre right stupid comment, didnāt look good, thought you where the original poster.
but still why not try things yourself and learn in the processā¦