sociofob

Members
  • Content Count

    8
  • Joined

  • Last visited

Everything posted by sociofob

  1. I supposed, the problem is in applying texture to mesh before texture is loaed. Obviously the solution here is to wait for loading, checking texture.isReady() time by time until it happens, but, it doesn't work in my case:( this.applyMaterials=function(){ if(wheelTexture.isReady&&rouletteTexture.isReady){ blackChipMesh.material=materialChips; redChipMesh.material=materialChips; blueChipMesh.material=materialChips; greenChipMesh.material=materialChips; whiteChipMesh.material=materialChips; plane.material = materialCarpet; tableMeshes[0].material = materialWheel; tableMeshes[1].material = materialRoulette; tableMeshes[2].material = materialBlack; } else { setTimeout (applyMaterials, 1000); } } I call this function onAssetsManager's onFinish callback var meshLoader = new BABYLON.AssetsManager(scene); //... meshLoader.onFinish = onMeshLoadingFinish; meshLoader.load(); But, I suspect this callback this callback dont work properly. Also, I have some error message in console, so that can be connected. I get this error although meshes are imported.
  2. Hi,I have hard times with asynchronous mesh loading. I need to apply textures to meshes right after meshes are ready. I'm importing in this way: var loader = new BABYLON.AssetsManager(scene); someLoader = loader.addMeshTask("roulette", "", "", "rouletteTable.obj"); anotherLoader =loader.addMeshTask("chip", "", "", "blackChip.obj"); someLoader.onSuccess = function (t) { t.loadedMeshes.forEach(function (m) { tableMeshArr.push(m); }); tableMeshArr[0].material = materialWheel; tableMeshArr[1].material = materialRoulette; tableMeshArr[2].material = materialBlack; }; anotherLoader.onSuccess = function (t) { t.loadedMeshes.forEach(function (m) { chip=m; chip.material=materialChips; }); }; loader.onFinish = applyObjTextures; loader.load(); var applyObjTextures = function () { tableMeshArr[0].material = materialWheel; tableMeshArr[1].material = materialRoulette; tableMeshArr[2].material = materialBlack; chip.material = materialChips; }; But it applies only to tableMeshArr[0] mesh. onFinish Callback works right after finishing importing first mesh, but I need a callback when all meshes are loaded.
  3. Oh wow, the problem was occured due to listening click event from canvas instead of window, that's why I have had some problems with triggering picking. Thanks!
  4. I'm trying to pick this big gray sphere, picking works, but actually in strange way. It really works even I'm clicking out of sphere shape, and sometimes doesn't work while clicking on the sphere shape. What is a collider here? I've tried to draw bounding boxes, expecting to see how colliders look, but it's not connected.
  5. Yep, It might help, but it's pretty different to flip round texture. By the way, I found the solution! It is about inverting 3d model in blender on Y axis.
  6. My bad, and now I set invertY parameter to false properly materialWheel.diffuseTexture = new BABYLON.Texture("Textures/wheel1.jpg", scene,false,false); But, it got much worse:
  7. Thank you for reply, Deltakosh I added a line to my code, liek this: var materialRoulette = new BABYLON.StandardMaterial("textureRoulette", scene); materialRoulette.invertY=false; materialRoulette.diffuseTexture = new BABYLON.Texture("Textures/reversedRoulette.jpg", scene); Unfortunately, it didn't help. I use the 3d object from blender. 1)I'm loading the object var loader = new BABYLON.AssetsManager(scene); tree = loader.addMeshTask("roulette", "", "", "roulette1.obj"); 2)Then I'm adding each mesh to the array t.loadedMeshes.forEach(function(m) { treeMeshArr.push(m); }); 3)Attaching texture to meshes: treeMeshArr[0].material=materialBlack; treeMeshArr[1].material=materialRoulette treeMeshArr[2].material=materialWheel;
  8. I'm trying to apply texture to my mesh, everything looks good except one thing: numbers are like on the photo attached. Does anyone know what is solution here?