- Home /
animations back and forth Again
I have done this a while back but now its for camera transitions. I built this script based on the last one an have not change much of any thin except for a few things I didn't need and added some variables i added for telling if the first person is true or false. I can't find a way to make it work. The other question was called "Multiple animations for one character" It halfway works I have to change some of the stuff in the editors window to go back and fourth but I can only use the key and work once and mode stays 0
using UnityEngine;
using System.Collections;
public class camrascript : MonoBehaviour {
public int mode = 0;
public bool firstperson = true;
public bool thirdperson = false;
void Update ()
{
animation.wrapMode = WrapMode.ClampForever;
if (Input.GetKeyDown ("t")) {
if(mode == 0) {
animation.Play("switchone");
mode = 1;
}
if(mode == 1) {
animation.Play("switchtwo");
mode = 0;
}
}
if(mode == 1){
firstperson = false;
thirdperson = true;
}
if(mode == 1){
firstperson = true;
thirdperson = false;
}
}
}
Comment