I have warm which is its head and has children (body and eyes). it turn around but i want it to go forward by keys Up , but it goes but not forward.what is the problem. here it is the script:
using UnityEngine;
using System.Collections;
public class SimpleMoveForward : MonoBehaviour {
public float MoveSpeed=0.1f;
public float RotationSpeed=0.1f;
public Vector3 Normal;
public float MoveX;
public float MoveZ;
void Start () {
}
// Update is called once per frame
void Update () {
float CurSpeed=Input.GetAxis("Vertical")*MoveSpeed;
Normal=CurSpeed*transform.TransformDirection(transform.forward).normalized;
MoveX=Normal.x;
MoveZ=Normal.z;
transform.Rotate(0,RotationSpeed*Input.GetAxis("Horizontal")*MoveSpeed,0);
transform.Translate(MoveX,0,MoveZ);
}
}