public void deAtach()
{
GameObject player = GameObject.Find("Player");
Vector3 worldPos = player.gameObject.transform.position;
player.transform.parent = null;
player.transform.rotation = Quaternion.identity;
player.transform.position = worldPos;
}
i have this piece of code, when called deAtach player from his actual parent and stay in the same world place, when i debug worldPos the values are correct with global position expected, but when applied to player the values are the same from localPosition,public void deAtach()
{
GameObject player = GameObject.Find("Player");
Vector3 worldPos = player.gameObject.transform.position;
player.transform.parent = null;
player.transform.rotation = Quaternion.identity;
player.transform.position = worldPos;
}
i have this piece of code, i call to deatach player from an object and preserve his position when he was parented but when i apply worldPos its like applying in local position but when i debug worldPos to see the values, they correspond with global