Search the Community

Showing results for tags 'assetsmanager'.



More search options

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • HTML5 Game Coding
    • News
    • Game Showcase
    • Facebook Instant Games
    • Coding and Game Design
  • Frameworks
    • Phaser 3
    • Phaser 2
    • Pixi.js
    • Babylon.js
    • Panda 2
    • melonJS
    • Haxe JS
    • Kiwi.js
  • General
    • General Talk
  • Business
    • Collaborations (un-paid)
    • Jobs (Hiring and Freelance)
    • Services Offered

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Website URL


Twitter


Skype


Location


Interests

Found 19 results

  1. Hi, would like to propose some possible improvements for AssetsManager there are multiple tasks that can be added to manager, but I think would be nice to have general `addTask(task: AbstractAssetTask)` so custom tasks could be created and added to manager if needed. right now response in onSuccess can be just string or ArrayBuffer but I think it would be great to get back request object so there would be more control what to do on success. minor but I didnt found way to add mime types to loader, but that can be fixed on server side as well, so server always serves files with proper mime type I came across this when was trying to implement svg file loader task to load svg as document. Was quick to implement task but could not add it to mananger and it needed request.responseXML so had no acces to it For now used text file tasks and parse string using DomParser. So what other think about this ? Thanks
  2. Hello, maybe this frequently required about preview dialog. like when shows character preview in a dialog or popup ui with new canvas. but i couldn't find the related post. in my case, not a full screen game it's web application. so, required multiple scenes for a dialog. BABYLONJS AssetsManager constructor needs a scene. and can not reuse these loaded textures with another scene in normal. when reused, it shows error like 'bindTexture: object not from this context' Is that possible to reuse loaded textures in another canvas with new scene? I don't want to request duplicated texture assets. thanks.
  3. Hello! I looked through the documentation but wasn't quite sure if I missed how I might load textures for my model. Perhaps I could do this using the TextureAssetTask or ImageAssetTask? Basically, I was wondering if there was a way to accomplish this: BABYLON.SceneLoader.ImportMesh("space_frig", "Assets/", "gate.babylon", scene, function (newMeshes, particleSystems) { meshPlayer = newMeshes[0]; meshPlayer.position.y = 2; //meshPlayer.receiveShadows = true; //shadowGenerator.getShadowMap().renderList.push(meshPlayer); meshPlayer.checkCollisions = true; meshPlayer.ellipsoid = new BABYLON.Vector3(1, 1, 1); meshPlayer.ellipsoidOffset = new BABYLON.Vector3(0, 0, 0); meshPlayer.scaling.x = meshPlayer.scaling.y = meshPlayer.scaling.z = 0.3; meshPlayer.material.diffuseTexture = shipTexture; meshPlayer.material.bumpTexture = new BABYLON.Texture('Assets/gate_bump.png', scene); meshPlayer.material.specularTexture = new BABYLON.Texture('Assets/gate_specular.png', scene); meshPlayer.material.emissiveTexture = new BABYLON.Texture('Assets/gate_illumination.png', scene); }); using the AssetsManager. Are there any playground samples readily available? Thank you for the assistance!
  4. https://www.babylonjs-playground.com/#B2S8JX Here is the demo. Both assetsManager.onProgress and assetsManager.onFinish stop working as the document described now. https://doc.babylonjs.com/how_to/how_to_use_assetsmanager#manager-callbacks-and-observables Is it a bug, or we need to update the document now? Sorry, they are working correctly. It's my fault to ignore the "loadingUIText". I expect that assetsManager.onFinish = function(tasks) will give the processed tasks.
  5. I've made a mesh in Blender and I've exported it to a .babylon file. I've also tried exporting the mesh as a .obj file but the problem persisted. I've checked my network tab in Chrome (on Mac OS btw) and I can see that the file has been downloaded so it's not a wrong path. Also, I get errors that the system couldn't find the .manifest file but I've found that that's not the issue. This is the error: Unable to import meshes from ./testObject.babylon: 0 This is the code I've been using: var loader = new BABYLON.AssetsManager(scene); house = loader.addMeshTask("pillar", "", "./", "testObject.babylon"); house.onSuccess = function (task) { console.log('---> DONE', task) task.loadedMeshes.forEach(function (m) { console.log('added'); m.position = BABYLON.Vector3.Zero(); m.scaling = new BABYLON.Vector3(0.2, 0.2, 0.2); shadowGenerator.getShadowMap().renderList.push(m); }); } house.onError = function() { console.log('ERROR', arguments); } loader.load();
  6. Hello 3D guru, According to the docs, we can load objects from *.babylon files this way: var assetsManager = new BABYLON.AssetsManager(scene); var meshTask = assetsManager.addMeshTask("skull task", "", "scenes/", "skull.babylon"); ... assetsManager.load(); Imagine, that *.babylon file contains many objects and I load these files dynamically, one by one. Later I want to delete/dispose all objects loaded from the specific file - how do I do that? Is there a built in way? Probably I could store all mesh names in a dictionary where keys are *.babylon file names, then in a loop go through the dict key values and dispose meshes. But maybe there is a shorter and more beautiful way?!
  7. Hello, Below is a PG for a scene I'm having problems with: https://playground.babylonjs.com/#X6KVNY I have a list of material definitions in JSON which I load with assetsManager, once this is loaded.. I then load a .babylon file. We then loop through each of the materials in the JSON file and if the material name matches that in the scene, it then change that material. Problem is, the scene displays before all the textures have loaded.. more noticable if you throttle the speed. In an ideal world, the spinning loading screen would show right up to the point that everything is ready, but I can't quite work out what I need to do. Yes, the textures & AO map are large, but this is really just to illustrate the problem better. Any help would be gratefully received. Thank you
  8. Hey I'd would like know when the texture is loaded on PBR glTF workflow, I did this code : assetsManager = new BABYLON.AssetsManager(scene); var textureTask = assetsManager.addTextureTask("albedoTexture texture", "assets/test/lambert1_baseColor.jpg", true, false); albedoTextureTask.onSuccess = function(task) { console.log(task.texture); meshes.material.albedoTexture = task.texture; } assetsManager.load(); The material assignation does nothing here thanks
  9. Hello, I'm looking for a way to change a loaded mesh texture after it been loaded, without fetching new obj file. for example - I have the same chair in different textures, when the user does something I want to change the chair's texture. I can create a different .mtl file for each variant, but is it possible to load just the .mtl file after the obj already been loaded? Thanks, Tomer.
  10. I'm new to babylonJS, so please forgive if this question is stupid. I'd like to use the playground and import an OBJ from my computer into the scene. I've looked at the documentation, but it seems to indicate I need a special loader. The sample of which does not work on my computer/Chrome or IE browser (i.e. https://www.babylonjs-playground.com/#28YUR5) And the other way seems to be to just use playground and use Assetsmanager. But the forums seem to indicate that Assetsmanager is for loading scenes or .babylon file and/or you "simply cant' do that, the OBJ must be on the web") I'm a little unclear on this. It seems a simple request, to be able to load an OBJ into playground and then save it off again as a zip (babylon scene, I assume, or perhaps just a zip of html code). I even saw someone try using loader.addMeshTask("A2", "", "http://localhost:8080/A2/", "a2.obj"); Which apparently works for them, but again, not me (though perhaps one must somehow set up one's computer to act like a localhost? ) Also, the docs seem limited on this...if I'm missing something (other than the Assetsmanager tutorial and page, obj loader page, and link already provided) could someone point me at the docs I need? Much appreciated,
  11. What's the difference between assetsManager and ImportMesh for importing custom meshes? thanks very much
  12. Hey everyone I just have two simple question I cannot find an answer too. First Question: The SpriteManager needs a capacity parameter, but why does it need this? Why can I not change this during runtime? What does it actually do (in the background) (except for just not showing any sprites that exceed the capacity)? Does it hurt performance at all if I just put a 'crazy' high number? Can the manager not just +1 the capacity by itself in the background whenever an instance of the sprite is created? It just seems so odd that I have to give it a number and I feel like I'm missing something here. My second question is how to exactly use the AssetsManager for sprites. The documentation gives this example: var imageTask = assetsManager.addImageTask("image task", "img.jpg"); imageTask.onSuccess = function(task) { console.log(task.image.width); } But that doesn't explain how to use it with a Sprite since the task returns an image, and a SpriteManager only requires an image url. Thank you in advance!
  13. Hello, I have a problem with get information how many percent of all mesh/textures were loaded, while I use AssetsManager. I have seen a similar topic, but there SceneLoader is used. Is it possible to get those information about loading progress, while I use AssetsManager?
  14. Hi, this is my code: for(var t = 0; t < edificios_texto.length; t++){ var loader = new BABYLON.AssetsManager(scene); //console.log(edificios_texto[n]); var edificio = loader.addMeshTask(t, "", "http://localhost:8080/modelos2/"+edificios_texto[t]+"/",edificios_texto[t]+".obj"); edificio.onSuccess = function (task) { //console.log(task.loadedMeshes.length); console.log(edificio.name); task.loadedMeshes.forEach(function(b) { b.scaling = new BABYLON.Vector3(5,5, 5); b.rotation.y = Math.PI; // cambiar las X var vertex_data = BABYLON.VertexData.ExtractFromMesh(b); for (var i = 0; i < vertex_data.normals.length; i+=3) { vertex_data.positions[i] *= -1; } vertex_data.applyToMesh(b); for (var i = 0; i < edificios.length; i++) { // console.log(edificios[i].texto); // console.log(t); if(edificios[i].texto == edificios_texto[t]){ var utmPlaceZ = edificios[i].x; var utmPlaceX = edificios[i].z; var utmPlaceXFromCentre = utmPlaceX - mapCentreX; var utmPlaceZFromCentre = utmPlaceZ - mapCentreZ; var x = utmPlaceXFromCentre/scaleX; var z = utmPlaceZFromCentre/scaleZ; b.position.x = x; b.position.z = z; break; } } }); } /* edificio.onFinish = function() { engine.runRenderLoop(function () { scene.render(); }); }; */ loader.load(); } I have to use the var edificios_texto[t] inside this function, How can I do it? JuanMa J.R
  15. Hello, I have a small problem that I do not understand with addMeshTask(). If I do this, it does not work. (I have no error in the console and I get out the value of 'key') // Not Work $.getJSON(global.game.nameProjet, function(json) { $.each(json, function (key, val) { addTask(key); }); }); function addTask(key) { global.game.meshTask = global.game.assetsManager.addMeshTask(key, "", "../../scene/"+key+"/", key+".babylon"); global.game.meshTask.onSuccess = function(task) { task.loadedMeshes[0].position = new BABYLON.Vector3(0, 0, 0); } } But if I do this, it works: // Work function addTask(key) { global.game.meshTask = global.game.assetsManager.addMeshTask(key, "", "../../scene/"+key+"/", key+".babylon"); global.game.meshTask.onSuccess = function(task) { task.loadedMeshes[0].position = new BABYLON.Vector3(0, 0, 0); } } addTask("scene_name"); I would like to load multiple scene with addMeshTask() from a list of json file, but it does not work. Why ? Thank you for your help.
  16. I try to clone the same mesh, but for some reason, the mesh is cloned once. How to clone the same mesh many? var loader = new BABYLON.AssetsManager(scene); dom1mesh = loader.addMeshTask('dom1', "", "/static/game/dom1/", "dom2.babylon"); mesh = new BABYLON.Mesh.CreateSphere(name, 8, 2, scene); mesh.position = new BABYLON.Vector3( 5, 1, 5); dom1mesh.onSuccess = function (task) { var nm = task.loadedMeshes[0]; nm.position = new BABYLON.Vector3(10, 1, 10); nm.parent = mesh; }; mesh1 = BABYLON.Mesh.CreateSphere(name, 8, 2, scene); mesh1.position = new BABYLON.Vector3( 15, 1, 15); dom1mesh.onSuccess = function (task) { var nm = task.loadedMeshes[0].clone('2'); nm.parent = mesh1; }; mesh2 = BABYLON.Mesh.CreateSphere(name, 8, 2, scene); mesh2.position = new BABYLON.Vector3( 25, 1, 25); dom1mesh.onSuccess = function (task) { var nm = task.loadedMeshes[0].clone('3'); nm.parent = mesh2; }; mesh3 = BABYLON.Mesh.CreateSphere(name, 8, 2, scene); mesh3.position = new BABYLON.Vector3( 35, 1, 35); dom1mesh.onSuccess = function (task) { var nm = task.loadedMeshes[0].clone('4'); nm.parent = mesh3; };
  17. Hi, Im new to Babylon.js but it seems fun, I have a simple question about the code below. It imports models and places them in random positions, whats the most efficient way to re-randomise the positions every second? I tried with setTimeout(function(){ window.location.reload(1); }, 5000); but this was a bit heavy, is there a way to just call the randomise bit again. Also is this the most efficient way to load multiple models, the hardware I'm targeting is slow so anything I can do to get a bit more performance is best- maybe I should clone the objects? Thanks <!DOCTYPE html><html><head> <meta http-equiv="Content-Type" content="text/html" charset="utf-8"/> <title>Babylon Test</title> <!--- link to the last version of babylon ---> <script src="babylon.2.2.js"></script> <script src="babylon.objFileLoader.js"></script> <style> html, body { overflow: hidden; width : 100%; height : 100%; margin : 0; padding : 0; } #renderCanvas { width : 100%; height : 100%; touch-action: none; } </style></head><body> <canvas id="renderCanvas"></canvas> <script> window.addEventListener('DOMContentLoaded', function(){ // get the canvas DOM element var canvas = document.getElementById('renderCanvas'); // load the 3D engine var engine = new BABYLON.Engine(canvas, true); // createScene function that creates and return the scene var createScene = function() { // create a basic BJS Scene object var scene = new BABYLON.Scene(engine); // create a FreeCamera, and set its position to (x:-10, y:10, z:-10) var camera = new BABYLON.FreeCamera('camera1', new BABYLON.Vector3(10, 10,-10), scene); camera.mode = BABYLON.Camera.ORTHOGRAPHIC_CAMERA; camera.orthoTop = 2.5; camera.orthoBottom = -2.5; camera.orthoLeft = -5; camera.orthoRight = 5; // target the camera to scene origin camera.setTarget(BABYLON.Vector3.Zero()); // attach the camera to the canvas camera.attachControl(canvas, false); // create a basic light, aiming 0,1,0 - meaning, to the sky var light = new BABYLON.HemisphericLight('light1', new BABYLON.Vector3(0,1,0), scene); // create a built-in "sphere" shape; its constructor takes 5 params: name, width, depth, subdivisions, scene var loader = new BABYLON.AssetsManager(scene); var meshNames = ["hex.obj", "cross.obj"]; var noOfMeshesToBuild = 6; var boundingBox = new BABYLON.Vector3(4,4,6); for (var i = 0; i < noOfMeshesToBuild; i++){ var cross = loader.addMeshTask("mesh" + i, "", "assets/", meshNames[Math.floor(Math.random() * meshNames.length)]); cross.onSuccess = function (task) { task.loadedMeshes[0].position = new BABYLON.Vector3((Math.random() -0.5) * boundingBox.x, (Math.random() -0.5) * boundingBox.x, (Math.random() -0.5) * boundingBox.x); }; }; loader.onFinish = function() { engine.runRenderLoop(function () { scene.render(); }); }; loader.load(); // return the created scene return scene; } // Now, call the createScene function that you just finished creating var scene = createScene(); // Register a render loop to repeatedly render the scene engine.runRenderLoop(function () { scene.render(); }); // Watch for browser/canvas resize events window.addEventListener("resize", function () { engine.resize(); }); }); }); </script></body></html>
  18. I want to clone the already loaded model and inserted into another location on the map. At the end of the time. var loader = new BABYLON.AssetsManager(scene);var taskMesh = loader.addMeshTask('t3', "", "game/t3/", "t.babylon");taskMesh.onSuccess = function (task) { task.loadedMeshes[0].position = new BABYLON.Vector3(0, 0, 0); task.loadedMeshes[0].parent = camera;};I have not found. Maybe something like this? taskMesh.loadedMeshes[0].clone();
  19. carringtonW84

    AssetsManager and CubeTexture

    Hello, I would like to use the assetsManager to load asynchronously a BABYLON.CubeTexture, is it possible ? Thank you for your responses ! Jérémy