Shiver script

Hi I’m trying to make a script that will make my player shiver whenever he is in a zone and aims but for some reason when I switch animations on entering a zone it just jerks down real fast and then goes back to the original aiming animation here is my script.
Thanks in advance :smile:

var PlayerAnimSec : GameObject;

function Start () {

}

function Update () {

}
function OnTriggerEnter(){
if(GameObject.Find(“Animations”).GetComponent(Player).PlayerState==3)
WaitForSeconds(5.0);
PlayerAnimSec.animation.Play(“ShiverAim Animation”);
PlayerAnimSec.animation.Stop(“AimingIdle Animation”);
}
function OnTriggerExit(){
if(GameObject.Find(“Animations”).GetComponent(Player).PlayerState==3)
WaitForSeconds(10.0);
PlayerAnimSec.animation.Stop(“ShiverAim Animation”);
PlayerAnimSec.animation.Play(“AimingIdle Animation”);
}

i would just change a boolean when the player enters the trigger:

function OnTriggerEnter(somthing : Collider){
	if(somthing.gameObject.tag == "player"){
		GameObject.Find("Animations").GetComponent(Play er).shiver  = true;
	}
}
function OnTriggerExit(somthing : Collider){
	if(somthing.gameObject.tag == "player"){
		GameObject.Find("Animations").GetComponent(Play er).shiver  = false;
	}
}

you need now a “var shiver : boolean;” in your player skript and just check the boolean when you want to play the animation.
ah and the tag player to your player :wink:

i hope that helped

Thanks it really helped :smile: