- Home /
Animation Triggers?
So I have made an animation in Blender, and I want to import the model into unity and be able to trigger the animation when I interact with the object. I don't want the animation to play automatically. It needs to play when I click on the object. Any tips?
Answer by bilek993 · Feb 03, 2013 at 02:12 PM
First you have to export your model from Blender e.g. Terrorist.FBX, next export your animation and name it e.g. Terrorist@die.FBX. Import that two files into unity 3d and place Terroist.FBX somewhere in the world space. Uncheck "Play Automatically" inside Inspector and add "Box Collider" (or other collider). Now we have to write script (I will use C#) and attach it into our GameObject (Terrorist model).
using UnityEngine;
using System.Collections;
public class Test : MonoBehaviour {
void Start () {
}
void Update () {
}
void OnMouseDown() {
gameObject.animation.Play("die");
}
}
Your answer
Follow this Question
Related Questions
Blender animation 1 Answer
Stop animation after played 30 times? 0 Answers
Can't understand how Animation's work 2 Answers
Animation Problems 1 Answer