- Home /
Making work 3ds Max animation in Unity
Can't make animation from 3ds Max work correctly.
I need to activate the animation of my Door1 and Door2 when button is pushed. Script triggers the animation (it's changing from "DoorsOpen" to "DoorsClosed"), but for some reason it's not relating to my doors (they stay still).
My Doors animation is connected to "level1" prefab. I made animation type Legacy so i was able to put this animation in my trigger object. If I move my Doors inside "TriggerRoom1" hierarchy and lose prefab connection i will be able to make my doors disappear on button push. I'm not sure if I need to do all this.
Please check my script and screenshots to see more details.
var Door : GameObject;
var DoorOpen : AnimationClip;
var DoorClose : AnimationClip;
var dclosed = true;
var unit : GameObject;
function Press(){
if (Input.GetKeyDown(KeyCode.E)){
if (dclosed){
Open();
}
else {
Close();}
}
}
function OnTriggerStay (unit:Collider){
if(unit.tag == "Player"){
Press();
}
}
function Open()
{
animation.clip = DoorOpen;
animation.Play();
yield WaitForSeconds(DoorOpen.length);
dclosed = false;
}
function Close()
{
animation.clip = DoorClose;
animation.Play();
yield WaitForSeconds(DoorOpen.length);
dclosed = true;
}
Answer by dakstab · Dec 31, 2013 at 09:53 PM
Watch this http://youtu.be/_4HPI6ZopB8?t=16m14s. I hope that helps you because it helped make my animations work.