我有一个场景设置,并使用字体加载器显示了一些文本。它运作良好,看起来像这样:
var count = 0;
var myInterval = setInterval(()=> {
// i do somehting every 5 second
if(count >= 10) {
// we can access variable outside the callback because we are using the arrow operator.
clearInterval(myInterval)
}
count++;
}, 5000);
但是,我不知道如何在此函数之外访问文本Mesh。我希望能够在加载文本后更新其坐标和旋转。各种方法始终会引发错误。访问以上任何变量都将返回undefined。即使使用loader.onLoadComplete也无效。有任何线索吗?