- Home /
Question by
giogio_17 · Jul 14, 2014 at 03:32 PM ·
c#instantiateprefab
How to create new tail in a simple 3D Snake
Hi, I'm new in Unity3D and at the moment I'm realizing a simple Snake 3D.I urgently need a little help about the generation of a new piece of tail when I eat an apple. How do I create a new piece of tail to be taken into at a certain distance from the piece of tail previous? I use this script for generate new tail, but the new tail are generate into the same point.(C#):
void OnTriggerEnter(Collider other) {
if ((other.gameObject.tag == "Mela")&&(melaobj == true)) {
scr = 1;
Destroy(other.gameObject);
melaobj = false;
Codaspam = (GameObject)Instantiate(Coda, new Vector3(target.position.x, target.position.y, target.position.z), Quaternion.identity);
Codaspam.transform.parent = target.transform;
}
}
Comment