Instantiate from a child

Instanteate as we know has 3 arguments: Instantiate (original : Object, position : Vector3, rotation : Quaternion)

My problem is that I’m trying to instanteate from a gun, this gun is a child where the character is the parent. The problem is that if in 2nd argument, the one where you put the location, I put the child postion the bullet comes out of the parent and not the child.

I also noticed that in the editor the coordinates of the gun are the distance to the parent, like if the parent was the origin.

Can someone help me with this ?

Look up world coordinates vs local coordinates.

thanks for the tip but I’m still having trouble, I tried this but the bullet still comes from the character and not the gun position:

Instantiate (GameObject.Find("Cube"),(new Vector3 (transform.position.x + GameObject.Find("M4").transform.localPosition.x, transform.position.y  + GameObject.Find("M4").transform.localPosition.y,transform.position.z + GameObject.Find("M4").transform.localPosition.z)) , GameObject.Find("M4").transform.rotation) ;

This is attached to the character (parent).

Thanks to all the help, heres how I fixed it:

GameObject.Find("M4").transform.TransformPoint(0,0.75F,0)

It comes perfectly out of the gun, thanks :smile: