lousha Posted December 14, 2017 Share Posted December 14, 2017 BABYLON.SceneLoader.ImportMesh("", "model/", "weixin.babylon", scene, function (newMeshes, particleSystems, skeletons) { var alpha = 0; scene.registerBeforeRender( function () { for (i = 0; i < 60; i++) { newMeshes[i].position = new BABYLON.Vector3(newMeshes[i].position.x + 10 * Math.sin(alpha), newMeshes[i].position.y + 0, newMeshes[i].position.z + 10 * Math.cos(alpha)); } alpha += 0.01; }); }); here is my code why it show "Cannot read property 'position' of undefined" Quote Link to comment Share on other sites More sharing options...
Wingnut Posted December 14, 2017 Share Posted December 14, 2017 Hi Lousha, welcome to the forum. Could you please insert this line after the importMesh... console.log(newMeshes.length); Then RUN and check JS console. We want to make sure that there are, at least... 60 mesh inside the newMeshes array. (thx for check) Another possible test... console.log(newMeshes[59])... this should NOT report undefined, of course. Talk again soon. GameMonetize 1 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.