Change parent without changing position?

Just found out that the SetParent function lets you keep world position values.

I tried this

Vector3 worldPos = transform.position;
Quaternion worldRot = transform.rotation;

transform.parent = other.transform;

transform.position = worldPos;
transform.rotation = worldRot;

But it didn’t work, why?

Well that should work. Did you resolve this or did you not?

Kind of, I realized it wasn’t a problem with parenting because the SetParent function is an official way to keep the position of an object when parenting. It still doesn’t work but at least now I know the problem isn’t the parenting part. I labeled it as resolved because my question, “Change parent without changing position?” was answered.

1 Like

okay