Animation 为什么我的播放器动画无法播放?

Animation 为什么我的播放器动画无法播放?,animation,unity3d,unityscript,Animation,Unity3d,Unityscript,我有一个模型,我已经有了行走和空闲的动画来播放,但不知何故,我永远无法得到跳跃来播放。我真的不明白为什么 我试过扳机,但还是不行 以下是我在名为AnimatePlayer的模型上的代码: #pragma strict var body : Transform; //Tranform the armature of the player model var mousexThreshold = 0.2; //Number of units for the mouse to move on x-a

我有一个模型,我已经有了行走和空闲的动画来播放,但不知何故,我永远无法得到跳跃来播放。我真的不明白为什么

我试过扳机,但还是不行

以下是我在名为AnimatePlayer的模型上的代码:

#pragma strict

var body : Transform; //Tranform the armature of the player model

var mousexThreshold = 0.2; //Number of units for the mouse to move on x-axis

//Settings for the Upper Body rotation
var sensitivityY = 15F;
var minimumY = -60F;
var maximumY = 60F;
var rotationY = 0F;


function Update () {
if( transform.rotation.eulerAngles.y == 270 ) { // Left rotation

if(Input.GetAxis("Horizontal") > 0) //Walk Backwards
{
animation["Walk"].speed = -2;
animation.Play("Walk");
}
else if(Input.GetAxis("Horizontal") < 0) //Walk Forward
{
animation["Walk"].speed = 2;
animation.Play("Walk");
}
else if(Input.GetAxis("Horizontal") == 0)
{
animation.Play("Idle");
}
}

if( transform.rotation.eulerAngles.y == 90.00001 ) { // Right rotation
if(Input.GetAxis("Horizontal") > 0) //Walk Forward
{
animation["Walk"].speed = 2;
animation.Play("Walk");
}
else if(Input.GetAxis("Horizontal") < 0) //Walk Backwards
{
animation["Walk"].speed = -2;
animation.Play("Walk");
}
else if(Input.GetAxis("Horizontal") == 0) //Return to standing posture
{
animation.Play("Idle");
}
}

// Transform the rotation of the player when mouse moves on the x-axis
var mousex : float = Input.GetAxis ("Mouse X");

if (mousex > mousexThreshold) //Player faces right
{
transform.forward = new Vector3(1f, 0f, 0f);
}
else if (mousex < -mousexThreshold) //Player faces left
{
transform.forward = new Vector3(-1f, 0f, 0f);
}
}

function LateUpdate(){
// will make the upper body of the model to be rotatable along the y-axis
rotationY += Input.GetAxis("Mouse Y") * sensitivityY;
rotationY = Mathf.Clamp (rotationY, minimumY, maximumY);

body.transform.localEulerAngles = new Vector3(0, rotationY, 0); 
}

function OnTriggerEnter(other : Collider){
if(other.tag == "Ground"){
animation.Play("Idle");
}else if(other.tag == "Platform"){
animation.Play("Idle"); 
}
}

function OnTriggerExit(other : Collider){
if(other.tag == "Ground"){
animation.Play("Jump");
}else if(other.tag == "Platform"){
 animation.Play("Jump");
}
}

正如你所看到的,我有一个触发器来播放跳跃动画,但仍然没有。是因为我一次播放了很多动画吗?

我不知道你是如何播放跳跃动画的。它是从一个OnTiggerEnter函数播放的…用于地面。当你的角色与地面相撞时你会跳吗?对不起,让我再次编辑它,因为我正在重做我上次做的事情。。等等,我们开始了:我编辑了它。这就是我最初的问题