But also i looked at the code from a guy called Edithson Abelard who dose tutorals for maya into unity. there is a link and video below.
http://www.youtube.com/watch?v=PvmMyMklwyo
Using this simple code as shown blow I will be able to run animations in unity from a click of a buttom.
#pragma strict
var doorObj:GameObject;
var isOpen = false;
var timeBeforeNextAnimation :float = 0;
function OnMouseDown(){
Debug.Log("mouse is down");
if( timeBeforeNextAnimation < Time.time )
{
if(!this.isOpen){
doorObj.animation.Play("open");
this.isOpen = true;
}else{
doorObj.animation.Play("close");
this.isOpen = false;
}
timeBeforeNextAnimation = Time.time + 3;
}
}
function Start () {
}
function Update () {
}
No comments:
Post a Comment