Unity animation import example

Unity animation import example

Postby BenChang » Wed Nov 07, 2012 10:26 pm

Screen shot 2012-11-07 at 5.20.17 PM.png
Screen shot 2012-11-07 at 5.20.17 PM.png (20.61 KiB) Viewed 848 times


Example of creating animations using file referencing in Maya, and using them in Unity.

Code: Select all
using UnityEngine;
using System.Collections;

public class controlScript : MonoBehaviour {

   // Use this for initialization
   void Start () {
      animation["idle"].wrapMode=WrapMode.Loop;
      animation["jump"].wrapMode=WrapMode.Once;
   }
   
   // Update is called once per frame
   void Update () {
      if (Input.GetKeyDown("space"))
      {
         animation.Play("jump");
         animation.CrossFadeQueued("idle",0.3f,QueueMode.CompleteOthers);
         
      }
   }
}
Attachments
Character referencing Maya project.zip
(232.43 KiB) Downloaded 102 times
animationDemo.unitypackage.zip
(1.15 MiB) Downloaded 125 times
User avatar
BenChang
 
Posts: 176
Joined: Mon Jan 17, 2011 4:48 pm

Return to Game Development

Who is online

Users browsing this forum: No registered users and 1 guest

cron