I want to make a dynamic render of user inputted text using three.js and dat.gui, so far i've made this to render out the text:
var displayGui = function(){
var gui = new dat.GUI();
var parameters = {
message:"sample",
spinVelocity: 0
}
//Adds Text controls
var myText = gui.add(parameters, 'message').name('Text');
myText.onChange(function () {
//adds text
var loader = new THREE.FontLoader();
loader.load('fonts/OpenSansBold.json', function(font) {
console.log(myText);
var textGeo = new THREE.TextGeometry(myText, {
font: font,
size: 200,
height: 50,
curveSegments: 12,
position: 3,
bevelThickness: 2,
bevelSize: 5,
bevelEnabled: true,
});
var textMaterial = new THREE.MeshPhongMaterial({ color: 0xff0000 });
var mesh = new THREE.Mesh(textGeo, textMaterial);
mesh.position.set(100, 100, 100);
scene.add(mesh);
});
});
gui.add(parameters, 'spinVelocity').name('Spin');
gui.open();
};
However, as you can see on here, it just renders out a big red 3D text that says [object Object] , i have suspected that this may be because var myText is an object and not a string, so i tried to String(myText) however, it did not change much and it still did not work.
Is this not working because the text is not a string or is this because three.js is not recognizing the text inputted by the user on the dat.gui interface?