Hello !
How i can make this clone fire As A child of the tank i hit it
var FireClone = Instantiate(Fire,transform.position,transform.rotation);
Hello !
How i can make this clone fire As A child of the tank i hit it
var FireClone = Instantiate(Fire,transform.position,transform.rotation);
I use C# mostly so forgive me if the JS is bad here:
var desiredParentGameObject; //Assume this is populated and is a GameObject
var targetGameObject; //Assume this is populated and is a GameObject
targetGameObject.transform.parent = desiredParentGameObject.transform;
You simply need to call SetParent with the object that you want to become a child.
I don’t know any JavaScript however this is a very simple answer, and I just had to answer this myself for my own project. They ought to be almost identical anyhow. =D
var FireClone = Instantiate(Fire,transform.position,transform.rotation);
FireClone.transform.SetParent(myParentObject.transform);