I'm not even sure where to begin looking. I would like to have a bunch of random people walking around during game play on there own accord. Any pointers or search terms to get me started? Birds would be cool too!
here is a script, you just plan the waypoints, the rest is in the script. It randomly selects waypoints and travels to them.
#pragma strict
var waypoint : Transform[];
var speed : float = 20;
var currentwaypoint = 0;
var loop : boolean = true;
var walkanimspeed : float = 0.6;
var rotatespeed : float = 4;
@script AddComponentMenu ("AI/AI people")
function Awake () {
waypoint[0] = transform;
}
function Update () {
if(!GetComponent(Rigidbody)) {
Debug.LogWarning("there is no rigidbody atttached to the object!");
return;
}
if(Physics.Raycast(transform.position, transform.forward, 5)) {
transform.Rotate(Vector3.up, 90 * rotatespeed * Time.smoothDeltaTime);
}
if(currentwaypoint < waypoint.length) {
var target : Vector3 = waypoint[currentwaypoint].position;
var movedirection : Vector3 = target - transform.position;
var velocity = rigidbody.velocity;
if(movedirection.magnitude < 1) {
animation.CrossFade("idle");
//currentwaypoint ++;
currentwaypoint = Random.Range(0, waypoint.length);
} else {
velocity = movedirection.normalized * speed;
animation["walk"].speed = walkanimspeed;
animation.CrossFade("walk");
}
} else {
if (loop) {
currentwaypoint = 0;
} else {
velocity = Vector3.zero;
}
}
rigidbody.velocity = velocity;
transform.LookAt(target);
}
Check the Virtual World example in the character customization demo. http://unity3d.com/support/resources/example-projects/charactercustomization
This is a demo of the Virtual world where people spawn randomly and start walking. http://unity3d.com/gallery/hosted-demos/virtualworld.html
You can use the same to recreate the environment in your game.
For birds, look at the Island Demo tutorial.
Is the second demo available for download? I would like to look at the script involved. Thank You!
Take a look at UnitySteers examples too, they provide a TON of functionality, like flocking, neighbor/obstacle avoidance, wandering, and more:
http://www.arges-systems.com/articles/35/unitysteer-steering-components-for-unity
http://www.youtube.com/watch?v=POUbAsr-6q4
Not the best tutorial ever made, but his series on AI covers movement with waypoints, etc, covers what you want pretty well!