简体   繁体   English

团结-移动刚体.velocity动画游戏对象

[英]Unity - move animated game object with rigidbody.velocity

I have an animated character , and I need move it forward 我有一个动画角色,我需要将其向前移动

I add rigibody to my character , and mover class 我将rigibody添加到我的角色和mover类中

when I disable animated controller it moves 当我禁用动画控制器时,它会移动

my mover class 我的动人阶级

 using UnityEngine;
    using System.Collections;

    public class Mover : MonoBehaviour {


        public float speed;
        // Use this for initialization
        void Start () {
            GetComponent<Rigidbody>().velocity = transform.forward * speed;

        }


    }

any suggestion how I can approach that 任何建议我该如何解决

在此处输入图片说明

I find out the answer 我找出答案

just uncheck Apply Root Motion 只是取消选中“ 应用根运动”

在此处输入图片说明

Might want to put it in Update() so its not just called one time. 可能希望将其放在Update()因此它不仅被调用了一次。

void Update () {
    GetComponent<Rigidbody>().velocity = transform.forward * speed * Time.smoothDeltaTime;
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM