Animating in Maya for Unity 3D – Scripting a door

Creating Animations In Maya for Unity 3D

There are many ways to create animations for Unity 3D. In this video watch as Edithson Abelard introduces how to create an animation in maya then export it for use in Unity 3D.
Using Unity 3D, you will learn how to split animations into parts to be used within our door script. Finally learn how to setup our door script to play the open and close animation based on our mouse click.

Topics covered include:

* Baking Animations in Maya.
* export fbx with animation.
* Spliting up an animation in Unity 3D.
* Scripting user interaction with mouse click.
* Trigger animation to play open or closed base on click.

Source code for Door Script.

#pragma strict
var doorObj:GameObject;
var isOpen = false;

function OnMouseDown(){
	Debug.Log("mouse is down");

	if(!this.isOpen){
		doorObj.animation.Play("open");
		this.isOpen = true;
	}else{
		doorObj.animation.Play("close");
		this.isOpen = false;
	}

}