So, I tried adding an animation to my character that plays whenever he falls from a certain height... The fall-detection works, but the animation always resets his transform to 0,0,0. I heard that in order to have an animation play locally to the current position of the gameObject, you need to attach it to an empty parent object of it. I tried that but it just. doesn't. work. It never plays.
private var fell : boolean = false;
var target : GameObject;
function OnCollisionEnter(collision : Collision)
{
if (collision.relativeVelocity.magnitude > 8)
{
fell = true;
}
}
function Start()
{
if(fell)
{
target = GameObject.Find("target");
target.animation.Play("FallingAnimation");
}
}
The target is the parent object containing the animation. What am I doing wrong? Is this even possible? X(
(Sorry if my english is horrible, I'm 13 and english isn't my native language)