Any transformations for a mesh are kept in its worldMatrix. Unless an particular function updates the worldMatrix it is not updated until the render phase.
c.position = newPosition c.parent = p in the render phase goes update worldMatrix of c, set c’s parent to p and apply the worldMatrix using p as the origin
c.setParent(p) / p.addChild(c) these function update the worldMatrix prior to the render phase and the update goes take the newPosition for c, calculate the position of c relative to p so that c remains in the same world position then calculate the worldMatrix