【发布时间】:2017-10-16 11:53:41
【问题描述】:
我们可以在 Babylon.JS 中渲染一个场景,从表单字段中读取位置/比例等值。但它是否允许在输入字段(如$('input').val())中实时更改场景监听。
var cusotm_position = $('input').val();
canvas = document.getElementById("renderCanvas");
engine = new BABYLON.Engine(canvas, true);
scene = createScene(); //draws a mesh at custom_position
engine.runRenderLoop(function () {
scene.render();
});
$("input").change(function(){
cusotm_position = $('input').val();
scene.render();//doesn't seem to be updating the mesh to new value of custom_position
});
我试图在输入变化的事件侦听器上调用scene.render();,但这似乎没有做任何事情。是否有类似 refrest/update 来更改更新的变量值。如果可以在不删除所有内容并重新创建新场景的情况下完成此操作,那就更好了。
【问题讨论】:
标签: babylonjs