- Home /
 
How do i move a GameObject to the same height as another GameObject?
 void Update()
 {
     if (Input.GetKeyDown(KeyCode.M))
     {
         var newProp = Instantiate(Prop, Character.transform.position, Quaternion.identity);
         newProp.transform.parent = gameObject.transform;
         Destroy(Character);
         this.GetComponent<propChange>().Character = newProp;
         float charY = Character.transform.position.y;
         float propY = Prop.transform.position.y;
         charY = propY;
         Debug.Log(charY);
     }
 }
 
               And below are all the variables:
 public GameObject Character;
 public GameObject Prop;
 public Vector3 Height;
 public Vector3 Y;
 
               So this is a prop change and the character changes prop when the user presses M. However the height of the player remains the same. I just need to make the character to the same height as the Prop so the prop will no longer be floating above the ground. Thanks :)
               Comment
              
 
               
              Your answer