Question by
zafar_iqbal · May 10, 2017 at 01:12 PM ·
unity 52dsprite
I have made a 3d terrain , i want to make 2D animals like cow sprite to move from one point to another. but i am not able to do it.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class sheepScript : MonoBehaviour {
public float speed=1.0f;
public Transform targetElement;
// Update is called once per frame
void Update () {
float step = speed * Time.deltaTime;
transform.Translate (Vector3.MoveTowards(transform.position,targetElement.position,step));
}
}
Comment