Reputation: 21452
I have an animated character , and I need move it forward
I add rigibody to my character , and mover class
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
Upvotes: 0
Views: 4389
Reputation: 8193
Might want to put it in Update()
so its not just called one time.
void Update () {
GetComponent<Rigidbody>().velocity = transform.forward * speed * Time.smoothDeltaTime;
}
Upvotes: 0