- Home /
Maya pistol animation splits up when played
Hello, I created a maya animation for an m9 object (pistol), and when I imported it to unity, at first the animation wouldn't play at all. It said that I had to change the animation type to legacy, because it couldn't be found. I changed the animation type to legacy, but then the pistol kind of broke, so that when the animation was played, all of the parts of the gun scattered all over my map. Anybody know how to fix it? my script for the animation is:
var TheDamage : int = 50; var Distance : float; var MaxDistance : float = 3; var Thepistol : Transform;
function Update () { if (Input.GetButtonDown("Fire1")) { //The pistol animation is called after the left mouse button is pressed Thepistol.animation.Play("Take 001"); //The attack function is called, casting the ray to see if anything is in front of you in direction forward/vector3 var hit : RaycastHit; if (Physics.Raycast (transform.position, transform.TransformDirection(Vector3.forward), hit))
{ Distance = hit.distance; if (Distance < MaxDistance) { hit.transform.SendMessage ("ApplyDamage", TheDamage, SendMessageOptions.DontRequireReceiver); } } } }
Also, the animation is listed as read-only under the unity editor, so I can't fix it.