It’s suppose to move the tool to the player’s head. The player as parent and can bring the tool around. The transformation isn’t working. It stays at it’s original position.
public GameObject tool;
public GameObject UsePanel;
public Camera Camera;
public GameObject Canvas;
public GameObject player;
public Renderer UItool;
private float Ypos;
private bool playerSmall;
private void Start()
{
UsePanel.SetActive(false);
UItool = GetComponent<MeshRenderer>();
}
public void ClosePanel_1()
{
Camera.enabled = false;
Canvas.SetActive(false);
tool.transform.SetParent(player.transform);
Ypos = player.transform.position.y;
tool.transform.position = new Vector3(player.transform.position.x, Ypos + 0.88f, player.transform.position.z);
if (player.transform.localScale.y == 1.5f)
{
tool.transform.position = new Vector3(player.transform.position.x, Ypos + 0.88f, player.transform.position.z);
}
else
{
tool.transform.position = new Vector3(player.transform.position.x, Ypos + 0.27f, player.transform.position.z);
}
UsePanel.SetActive(true);
}