²Digitalgames Posted December 14, 2015 Share Posted December 14, 2015 Hello, i need to apply renderingGroupId= 1 ; to all meshes loaded in one babylon scene. BABYLON.SceneLoader.ImportMesh("", "scenes/", "InterfaceObjects.babylon", scene, function (newMeshes) { var InterfaceMeshes = newMeshes InterfaceMeshes.renderingGroupId = 1;});I want to avoid calling newMeshes[0] ,newMeshes[1] ...and so on and apply to the whole array of meshes. Is that possible ? Quote Link to comment Share on other sites More sharing options...
RaananW Posted December 14, 2015 Share Posted December 14, 2015 well, iterate newMeshes.forEach(function(mesh) { mesh.renderingGroupId = 1;}); GameMonetize 1 Quote Link to comment Share on other sites More sharing options...
²Digitalgames Posted December 14, 2015 Author Share Posted December 14, 2015 I would not have found this by myself and its working ! Great , thank you. But i would be interested how arrays are used or can be used in Babylon.js. I am using arrays alot in another scripting language. What i found was smart array , but it can´t see a connection to regular uses of arrays. Quote Link to comment Share on other sites More sharing options...
RaananW Posted December 14, 2015 Share Posted December 14, 2015 Most of the arrays used in BabylonJS are the regular JavaScript arrays.I find Mozilla's pages very helpful - https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array The SmartArray (implemented in Babylon.js) is seldom used. You can find the API here - http://doc.babylonjs.com/classes/2.2/SmartArrayIt is a wrapper around the regular JS Array to add a bit more functionality. Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted December 14, 2015 Share Posted December 14, 2015 The SmartArray is here for only one reason: the garbage collector. SmartArray has a way to clear its content without stressing the GC which is really important internally 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.