how do i make my character do some certain moves if i dont move him,.,.,like look around,yawn,cough
This is done usually at the animation level: when the character gets still for some time, play the idle animation in loop mode. The best way to detect idle state is to keep track of the character velocity: this allows you do differentiate idle, walk and run states - something like this (script attached to the player):
private var lastPos: Vector3; function Start(){ lastPos = transform.position; } function Update(){ // calculate player velocity: var vel = (transform.position - lastPos).magnitude / Time.deltaTime; lastPos = transform.position; // update last position if (vel < 0.2){ // play idle when stopped... animation.CrossFade("idle"); } else if (vel < 2.5){ // play walk at medium speeds... animation.CrossFade("walk"); } else { // and play run at higher speeds animation.CrossFade("run"); } }
Obviously, your model must have these animations, and you probably will have to tweak the velocity thresholds to achieve better results in your case.