In my Three.js scene, I have a globe with an Earth texture that can be rotated using OrbitControls. I am looking to add labels that remain in a fixed position on the globe, such as an "Australia" label pinned to the centre of Australia's Latitude & Longitude. The labels need to be HTML elements for easier content management and styling.
After studying an example (https://www.gsmlondon.ac.uk/global-oil-map/#1995-exporters), which features a similar setup with Three.js globe and HTML labels, I am trying to replicate the functionality where the labels stay above their respective countries even when the globe is rotated.
I have successfully translated Latitude & Longitude coordinates into X, Y, Z coordinates for my scene using a calculation function. However, I am struggling to make the HTML elements rotate along with the globe. My attempted code to rotate the elements on the X axis within the render loop is not working as expected.
If anyone has insight on how to achieve the desired effect of keeping the HTML elements always positioned correctly above their designated locations regardless of scene rotation, I would greatly appreciate it.
Thank you.