Hi,
Any advise on how to center the text when setting a parent?
For the text to be centered, it should be farther up:
The MSDF TextRenderer is not a mesh, so parenting it to the sphere only applies the sphere’s world matrix. It doesn’t get a mesh bounding box, origin, or pivot that Babylon can automatically recenter.
textAlign: “center” centers the paragraph layout, but that layout uses font metrics/line boxes, not the exact visible glyph pixels. With ascenders/descenders and line-height, the visual center can look offset.
For your playground, offset the whole text group after parenting:
textRenderer.parent = sphere;
// Positive Y moves the text block up relative to the parent.
textRenderer.transformMatrix = BABYLON.Matrix.Translation(0, 0.1, 0);