I am facing an issue with THREE.JS involving the addition of 3D text to my scene using the following code:
var loader = new THREE.FontLoader();
loader.load( '3rdparty/three.js/fonts/helvetiker_regular.typeface.json',function ( font ) {
var material = new THREE.MeshPhongMaterial({color: 0xff0000});
var textGeom = new THREE.TextGeometry( 'Hello World!', {font: font});
var textMesh = new THREE.Mesh( textGeom, material );
var bBox = new THREE.Box3().setFromObject(_object);
textMesh.position.set((bBox.max.x - bBox.min.x) / 2 +
bBox.min.x,bBox.max.y + 10,(bBox.max.z - bBox.min.z) / 2 + bBox.min.z);
scene.add(textMesh);
});
The issue is that the object only appears when I zoom in on the scene. Even when I unzoom, the object remains visible.
After adding text, it does not show up
After zooming in, the text becomes visible
Even after unzooming, the text remains visible
Below is the camera configuration (so it's not a far camera parameter issue):
new THREE.PerspectiveCamera(45,SCREEN_WIDTH/SCREEN_HEIGHT,0.1,99999999);
How can I make the text appear immediately after being added to the scene?