Question by 
               deniboy0541 · Oct 15, 2020 at 04:36 PM · 
                transformpositionparent  
              
 
              How to set the transform.position of a GameObject after making it a child?
I'm trying to pick up a weapon and setting it to it's starting point, which is in front of the character, because it is an ego-shooter. The problem is, that when I make the weapon the child of the inventar holder, the position always stays the same, also if I try to change it through script.
My Code:
 private void OnTriggerEnter(Collider other)
 {
     if(other.CompareTag("Player"))
     {
         PickUp();
     }
 }
 void PickUp()
 {
     transform.parent = inventarHolder.transform;
     Vector3 position = new Vector3(0.073f, -2.493f, 9.73f);
     transform.localPosition = position;
 }
 
               I always want to add the rotation. But everything step by step :)
               Comment
              
 
               
              Your answer