I want to create an AI that is moving randomly every 10 seconds.
for example, on a road, there are 2 AI’s… every 10 seconds, they will moved on a random position.
Thanks!
I want to create an AI that is moving randomly every 10 seconds.
for example, on a road, there are 2 AI’s… every 10 seconds, they will moved on a random position.
Thanks!
// Instantiates prefab somewhere between -10.0 and 10.0 on the x-z plane
var prefab : GameObject;
function Start () {
var position: Vector3 = Vector3(Random.Range(-10.0, 10.0), 0, Random.Range(-10.0, 10.0));
Instantiate(prefab, position, Quaternion.identity);
}
http://unity3d.com/support/documentation/ScriptReference/Random.Range.html