Hey guys,
we try to center a 3Dtext (textmesh) to a 3DModel while changing the camera. At the moment we have a code like this:
descriptionText.transform.position = b.GetComponent<Transform>().position
+ new Vector3(0,10,0);
Camera.mainCamera.WorldToViewportPoint(descriptionText.transform.position);
descriptionText.transform.rotation = Camera.mainCamera.transform.rotation;
At first we change the position of the textmesh to the 3DModel, then we change the viewport and rotation of the textmesh, so it looks at the camera. Now we have the problem, that the text begins at the centre of the 3DModel, thus the text is shifted (depends on camera position and rotation).
Does anyone have a solution for this problem?