小编Ozg*_*cin的帖子

统一animation.play()不起作用

我有一个简单的脚本,应该动画我的播放器,但它不起作用.我读了一段时间的论坛,有些人有关于动画遗留选项的问题,我修复了它,但我的角色仍然没有动画,并且没有任何编译错误.这是我的脚本:

using UnityEngine;
using System.Collections;

public class maincharacter : MonoBehaviour {

    void Start () {
    }

    float xSpeed = 10f;
    float zSpeed = 10f;
    public float playerMovementSpeed = 10f;

    void Update () {
       float deltaX = Input.GetAxis ("Horizontal") * xSpeed;
       float deltaZ = Input.GetAxis ("Vertical") * zSpeed;

       Vector3 trans = new Vector3 (deltaX + deltaZ ,0f,deltaZ - deltaX);
       transform.Translate (trans.normalized * Time.deltaTime * playerMovementSpeed, Space.World);

       animation.Play ("mcrunsw");

       /*if (deltaX != 0 || deltaZ != 0) {
                 animation.Play ("mcrunsw");
          }*/
    } …
Run Code Online (Sandbox Code Playgroud)

c# scripting animation unity-game-engine

1
推荐指数
1
解决办法
4万
查看次数

标签 统计

animation ×1

c# ×1

scripting ×1

unity-game-engine ×1