Search the Community

Showing results for tags 'import'.

More search options

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


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

Find results in...

Find results that contain...

Date Created

  • Start


Last Updated

  • Start


Filter by number of...


  • Start



Website URL





Found 57 results

  1. Hi, I'm pretty new to babylon.js and the "3d world" in general. What file types can be imported into babylon.js? I couldn't seem to find a list that specifies this. Thanks for your help
  2. Hi, I'm new to Babylon and try to load my mesh from a remote address. I put it in my aws s3 bucket and public it on aws cloudfront. So it is accessible via http request. Can I stringify .babylon file as json file and feed it to SceneLoader? And load it to my scene via ImportMesh("","", "data:mydatahere", scene, onsuccess, progressCallBack, onerror)? or is there a better way? Thanks, Derek
  3. Hi, I'm trying to import meshes with multiple animations (from Blender). Is there any description of correct workflow on how to make Babylon compatible animations in Blender? Single animation works nicely when you just manually fix scaling and rotation problems. But no matter how you append more animations into one Blender file it seems to me that transformations get messed up in export process. I've tried using Action Library and Pose Library, but both strategies produce weird twisting and morphing of the mesh. The result does somewhat resemble the intended animation, but it's hard to say what exactly goes wrong. Of course obvious workaround is to put every animation in separate file but that quickly makes download sizes unpractical (several 100 MBs).
  4. Hello, For a test, I download a zip file. I extract files with JSZip. All files are OBJ files. I use babylon.objFileLoader for OBJ files. After extraction, I try to use BABYLON.SceneLoader.ImportMesh with rawData like this : var rawData = "data:" + contentOfFiles; BABYLON.SceneLoader.ImportMesh("", "model.obj", rawData, scene, function(){ console.log("Success"); }, function(){ console.log("PROGRESS"); }); But that's not work :((( I receive this message : importMesh of undefined from undefined version: undefined, exporter version: undefined importMesh has failed JSON parse Someone have an idea ? How can I import mu obj files ? Thanks Loïc
  5. Latest NPM for BabylonJS 3.0 alpha includes Canvas2D! I am having difficulty importing Canvas2D into my project. I have no troubles at all with regular BabylonJS only with importing Canvas2D. // I can import the main babylonJS in a variety of ways and they all work. // explicit imports import { Sound, Mesh, ShadowGenerator, ... } from 'babylonjs' // default and named import BABYLON, { Sound, Mesh, ShadowGenerator, ... } from 'babylonjs' // tried also named default only and * After that I am importing the Canvas2D and have tried various ways. // named default import import Canvas2D from 'babylonjs/babylon.canvas2d' // as side-effect import from 'babylonjs/babylon.canvas2d' // explicit imports import { ScreenSpaceCanvas2D } from 'babylonjs/babylon.canvas2d' The error I am getting is "TypeError: Cannot read property 'Effect' of undefined". So, basically line 1 of babylon.canvas2d, where BABYLON is undefined. Removing those will fail later (ie: BABYLON.Vector2 being undefined). I was reading on the ES6 spec that there is no guarantee of ordering only that the imports will all be run before code is executed. I looked through other NPMs where I can import add on modules separately and they have extra declarations in package.json (ie: "jsnext:main": "index", "module": index") and they are exporting explicitly in index.js the other modules from the main project. I tried that and a few other things, but am unable to get Canvas2D to import unfortunately. If anybody has successfully imported BabylonJS without creating their own bundle any tips would be appreciated. I'm using webpack and babel (
  6. I have two .babylon files. One with meshes and skeletons, but no animation. The other one has skeletons and animation, but no meshes. Turns out BABYLON.SceneLoader.ImportMesh doesn't load the skeletons at all, because there's no mesh in the file. Is there any way to import .babylon file with just skeletons and animation?
  7. I'm currently trying to get my first Phaser project working, fiddled around a whole day trying to get it all set up but since I'm completely new to writing bigger JS projects with modules, I have no idea how any of this works, even after googling and reading a million guides. I want to write TypeScript in VSCode. So first I installed phaser with npm install phaser --save Then I import Phaser in my app.ts with import Phaser = require("phaser-ce"); Did I pick the right syntax out of the 50 different ones? Whatever, this is the one I chose. So, while im coding I now got code completion and type hints working, but after compiling to JS, I now have multiple problems: First of all, the compiler adds code to my main JS file which tries to access a global module or exports object which obviously doesn't exist. Why? Why does it assume this exists? How can I turn this off? No idea. This is what it pastes righto onto line 2 of the main JS file: Object.defineProperty(exports, "__esModule", { value: true }); And since "exports" doesn't exist unless I hack it into the HTML file, it gives me an error. But now the more important question is... how exactly do I import Phaser? As far as I know you can't really import other JS files into another? (At least not in ES5 as far as I know). (Great, after switching my text color to an illegible light gray, forcing me to manually recolor all the text to black, now the text editor here creates a new paragraph instead of a new line everytime I press enter. Whyyyyyyy...........) In order to get code hints I need to import Phaser in my TypeScript file with the import statement, but if I use anything other than "module": "commonjs" in my tsconfig.json It can't find phaser anymore: // tsconfig.json // ... "compilerOptions": { "module": "commonjs", // ... // game.ts import Phaser = require("phaser-ce"); // WORKS // tsconfig.json // ... "compilerOptions": { "module": "anything other than commonjs", // ... // game.ts import * as Phaser from "phaser-ce"; // Can't use same syntax. Why? I don't know. // TypeScriptCompiler error: // Cannot find module 'phaser-ce' But of course commonjs doesn't work in the browser so... I tried instead to load the typings manually by copying the into /node_modules/@types/phaser and then instead of importing Phaser, instead referencing the typings with: /// <reference types="phaser"/> And including phaser.js in my index.htm But since Phaser itself has a bunch of dependencies that it tries to load with require() which of course doesn't exist and even if it did couldn't work, how am I supposed to do this correctly? It just whines about Pixi not being defined and some other stuff. I read but it never mentions how Pixi etc is supposed to be included and doesn't say anything about require, export, module errors, it just works apparently, but not for me. Which of the 50 different module systems does Phaser use, how does it export itself? RequireJS? AMD? UMD? ES6? ES2015? I have no idea how many different methods there are and how to tell which one is being used. How do I import it correctly? Do I need to manually add ALL *.js files of phaser into the <head> of my index.htm? This is all waaaaay too confusing....., help please Edit: I got a basic version working for now by just scrapping all the import stuff, setting tsconfig.json "module" to "none", adding a ///<reference types="phaser-ce"/> at the top of my game.ts and just including phaser.js in the html file. How it gets it's dependencies I still don't know but at least it works now. I also have no Idea where it gets the typings from, I guess it must be magic.
  8. Hey! I will just link the relevant code and then ask the question (ignore the material parameter, is from an older build still have to get rid of it): function GenerateRandomObject(scene, material){ var nekej = BABYLON.Mesh.CreateBox("box1", 1, scene); nekej.position = new BABYLON.Vector3(getRandom(8, 90, true), 0.5, 90); nekej.rotation.y = getRandom(0, 360, true); nekej.isVisible = false; BABYLON.SceneLoader.ImportMesh("", "_resources/", "Drevo2.babylon", scene, function (newMeshes, particleSystems) { newMeshes[0].parent = nekej; }); return nekej; } So this is the way I create every new instance of a background object. This happens about 0.5 - 2 times every second for this type of object. More with others that I create with similar functions just different imported meshes. So my question is if there is a better way to import/use an imported mesh so i would not need to import the same mesh over and over again every single time i create a new object with that mesh. Thank you very much for any answers you might provide, with best regards, Satiana
  9. Hi again, it's going to be long and maybe silly post once again. Today's topic is character animation and movement using physics (Cannon.js for now). Still doing the Bomberman clone. I've been digging for a some kind of a tutorial for this, but have not found it so far. What I basically wish to know is how to: Import a character with animations "the right way". I currently have a character, which has animations for idle/walking/running/jumping(start/looping/end). The problem is, the animations are all in different files and the format is FBX. So, what is the preferred way to import my character to BabylonJS? Should I just try to mash all the animations in a single file somehow? Currently, if I export the FBX to .babylon format, I get multiple files for each animation. When I import the animations to my scene, they are all playing by default. Sorry if this is a beginner question... Move a character using physics properly. I guess the main idea is similar to what Unity does. I created a picture (Image 1) attached to my post to demonstrate what I mean. I currently have a SphereImpostor, which is moving using keyboard controls (using addImpulse). Now, I guess what I need to do is kind of have all the other stuff such as the visible mesh that has the animations and the box for wall collisions to somehow stick with the ball that is moving. And also to rotate the animation to the direction where the ball is leading the character Am I on the right track here? Image 1: How I would like the 'character' to be like. Some threads that I dug up on the similar matters: Buuuut he decided to not use physics at all. Also found this demo, but it's from 2014...
  10. Hello. I'm having trouble importing a scene from blender. The screen is and enless loading loop and I'm getting this error in console: Uncaught TypeError: e.UniversalCamera is not a constructor if (BABYLON.Engine.isSupported()) { var canvas = document.getElementById("renderCanvas"); var engine = new BABYLON.Engine(canvas, true); engine.enableOfflineSupport = false; BABYLON.SceneLoader.Load("", "guy.babylon", engine, function (newScene) { var camera = new BABYLON.ArcRotateCamera("ArcRotateCamera", 0, 0, 0, BABYLON.Vector3.Zero(), scene); var light = new BABYLON.HemisphericLight("light1", new BABYLON.Vector3(0, 1, 0), scene); scene.clearColor = new BABYLON.Color3(0, 1, 0); camera.setPosition(new BABYLON.Vector3(-10, 50, -50)); camera.attachControl(canvas, false); light.intensity = .5; // Wait for textures and shaders to be ready newScene.executeWhenReady(function () { // Attach camera to canvas inputs newScene.activeCamera.attachControl(canvas); // Once the scene is loaded, just register a render loop to render it engine.runRenderLoop(function() { newScene.render(); }); }); }, function (progress) { // To do: give progress feedback to user }); }
  11. Hello people, I had a good conversation with @JCPalmer. I asked him if he could add parent variable for instance in .babylon file and he did it. you can read it here : At the moment, the fileloader do not apply the right parent but always the same parent of original mesh. I will try to find solution for the babylon fileloader read parent for instance and apply this My idea > Add this in mesh file : // Instances if (parsedMesh.instances) { ... if (parsedInstance.parentId) { instance._waitingParentId = parsedInstance.parentId; } ... } Because in fileLoader, this code allready exist and all instances are in "meshes" array : // Connect parents for (index = 0, cache = scene.meshes.length; index < cache; index++) { var mesh = scene.meshes[index]; if (mesh._waitingParentId) { mesh.parent = scene.getLastEntryByID(mesh._waitingParentId); mesh._waitingParentId = undefined; } ... } What do you think @Deltakosh? Have a nice day, Letsbro studio team.
  12. Hi, So I have another problem, this time with the PBR textures imported from unity using Babylon2unity. If I am using any light other than Hemilight (pbr material from unity seem to work with it), all the textures show up black. Again it might be solved by some tweaks in the texture objects, so I have been looking for the problem for hours now... I had some successes, failure, a lot of frustration. So I thought i should ask for your help. On the first image this is the results of my tweaking using an omnilight. So I though I had it figured out, by changing the reflectivityColor and reflectionColor from 0,0,0 to 1,1,1 it seems I get back my texture for the little robot in the middle (the infamous roger robot). With some shadow etc. I also changed the "hasAlpha" in the reflectivityTexture (because it does have alpha) and changed useMicroSurfaceFromReflectivityMapAlpha and useAutoMicroSurfaceFromReflectivityMap to "true" (one of them was already to true, can't remember which one) - that did work with matte region becoming matte, at long last. So I said Great ! lets change the reflectivity color and reflexion color for one of the tile type (the little hexagons thingy). By doing that I also get back the texture normal color BUT, light does not seem to interact in the same way, the mesh is lighted both in front and behind similarly... the back face should be black no? (see image 2). The last 2 images is with the hemilight (front and back) , it seems the material is behaving normally... You might be wondering why I am persisting on resolving this issue when I have a perfectly well behaved light source at disposal... and that is a very relevant question. Any idea(s) ? Light source code: var hemiLight = new BABYLON.HemisphericLight('hemiLight', new BABYLON.Vector3(0, 0, -30), scene); hemiLight.intensity = 2; // var sun = new BABYLON.PointLight("sun", new BABYLON.Vector3(0, 50, 0), scene); // sun.intensity = 2;
  13. Hey guys, I have just made a little mesh and a simple animation on maya, but since there is no exporter from maya and no 3dsmax on mac.. im using unity to export. It works great for the mesh, texture etc, but I cant manage to access the animation... it is in the babylon file, but it's exploded by property like in the picture, I have two of those for each property probably because my mesh has two separate parts... Somebody knows how I can call the animation to run once ? Thanks
  14. Hey! I'm struggling really hard trying to get anything to work - I checked to Playgrounds, forums and documentation but I can not find anything helpful about working with imported meshes. Am I blind? Most of the playground examples I can find work with simple meshes like cubes and spheres, but that is not helpful for me. var frame = new BABYLON.Mesh.CreateBox("box", 100, scene); frame.isVisible = false; var loader = new BABYLON.AssetsManager(scene); var meshTask = loader.addMeshTask("FW", "", "assets/", "groups.babylon"); meshTask.onSuccess = function (task) { LIBRARY['kubus'] = task.loadedMeshes[0]; LIBRARY['kubus'].parent = frame; } And then I can scale the frame without destroying my object. This seems rather complex for such a simple task, is there a better way? But how do I access the object now? Anything outside the onSuccess function happens before so everytime I try to reference LIBRARY['kubus'] outside this function, I just get an "undefined" error. I tried it with onFinish and put it after loader.load(). Next big problem: How do I access groups I set up in 3dsmax - is it even possible? Is there a better way than looking at the parent object of every mesh and comparing them? For example, this imported object consists of 70 meshes but I have models with up to 200 meshes and this approach seems rather counter intuitive. And for further reading, are there any further ressources I could check out? I don't find the Playground search to be too helpful and the documentation is great when needing assistance in rendering and other engine stuff but I find it lacking in the "importing and working with meshes and objects"-department. And what exactly is the difference between the name of an object and the name of the variable? I really don't understand this approach, is the name used internally for reference? Can I access the objects like this? Is there a way to get an overview of all objects in a scene? Thanks for all the help!
  15. Hello all! I am trying to create a Tiled map for a little sidescrolling game i'm making, and I've followed the Phaser and Tiled documentation, but I for whatever reason cannot get the map imported correctly. I'm using Phaser v2.4.4, and one of the errors I'm getting is "Phaser.Tileset - image tile area is not an even multiple of tile size", and through a series of tests I found that my tilemap isn't even loading in which is probably the main reason for my issues. I have it in the preload (game.load.tilemap('Doom_Map', 'js/Doom_Map.json', null, Phaser.Tilemap.TILED_JSON); ) and in the create function (map = game.add.tilemap('Doom_Map');) but it seems to die out here. Any help or ideas would be appreciated!
  16. Hello everyone ! This is my first post here and i'm not used to so apologies if I do some begginers mistakes. I look for it in internet but nothing about this error : TypeError: undefined is not an object (evaluating 's._addPendingData') I'm just trying to import a mesh into my scene. This is my code : var Ground = function(x, z, game, scene) { // Call the super class BABYLON.Mesh, "ground", game); console.log("Adding the ground"); BABYLON.SceneLoader.ImportMesh("", "assets/", "scene.babylon", scene, function (newMeshes, particleSystems) { this = newMeshes[0]; this.isVisible = true; this.parent = this; this.shadows.getShadowMap().renderList.push(ground); this.position = new BABYLON.Vector3(x, 0.75, z); this.receiveShadows = true; }); console.log("Ground added"); //console.log("number of meshes : " + game.assets['ground'].meshes.length); //var ground = game.assets['ground'].meshes; }; // Our object is a GameObject Ground.prototype = Object.create(GameObject.prototype); // And its constructor is the Ground function described above. Ground.prototype.constructor = Ground; and my file architecture : Main Folder -- Ground -- assets -- scene/babylon Does someone have information for me ? Thank you in advance, enjoy your day UPDATE : I've made some changes to my code and i put all my files on a server (cloud foundry, so you guys can see my code : var Ground = function(x, z, game, scene) { // Call the super class BABYLON.Mesh, "ground", game); console.log("Adding the ground"); BABYLON.SceneLoader.ImportMesh("", "assets/", "scene.babylon", scene, function (newMeshes, particleSystems) { this.meshes = newMeshes[0]; this.meshes.isVisible = true; this.meshes.parent = this; this.meshes.shadows.getShadowMap().renderList.push(ground); this.meshes.position = new BABYLON.Vector3(x, 0.75, z); this.meshes.receiveShadows = true; }); console.log("Ground added"); //console.log("number of meshes : " + game.assets['ground'].meshes.length); //var ground = game.assets['ground'].meshes; }; // Our object is a GameObject Ground.prototype = Object.create(GameObject.prototype); // And its constructor is the Ground function described above. Ground.prototype.constructor = Ground; The error is the same but without the 's.' : Uncaught TypeError: Cannot read property '_addPendingData' of undefined Thank you for you consideration EDIT : If you need it this is the complet file system : Block.js 636B Game.js 3.5K GameObject.js 356B Ground.js 927B Level.js 1.2K Player.js 4.2K assets/ - index.html 704B js/ - levels.js 771B old/ - cd assets/ key.babylon 47.7K key.babylon.manifest 78B scene.babylon 163.5K scene.babylon.manifest 79B skybox/ - cd ../js Oimo.js 302.5K babylon.2.3.js 948.4K cannon.js 384.2K hand-1.3.7.js 29.6K
  17. How can I use the same mesh for 2 different object in the 3D space ? What I tried: //... //before the mesh is loaded we use another mesh hero = BABYLON.Mesh.CreateSphere("sphere1", 16, 0.1, scene); enemy = BABYLON.Mesh.CreateSphere("sphere2", 16, 0.1, scene); BABYLON.SceneLoader.ImportMesh("fr", "/", "models/5.babylon", scene, function (newMeshes, particleSystems) { = newMeshes[0]; hero = newMeshes[0]; enemy = newMeshes[0] //how can I separate hero and enemy again ? } ); //... If there are different ways to do , give me the one that uses the least resources.
  18. Hello. How do I get access, tankard? For example to move it via js.
  19. Hi guys, (I'm so sorry for my English) I'm new in babylon's programming and I'm in trouble. i'm importing a local Mesh with the method: BABYLON.SceneLoader.ImportMesh("him", "models/Dude/", "dude.babylon", scene, function(newMeshes){ scene.cameras[0].setTarget(newMeshes[0].position); scene.getMeshByName("him").scaling = new BABYLON.Vector3(0.07, 0.07, 0.07); //this work }); scene.getMeshByName("him").position +=10; //scene.getMeshByName("him") is null In the function's scope of the argument (function(newMeshes){...}) i can interact with my Mesh (if i inspect the scene i can see it). However out of that function i can't reach it. How can i interact with this imported mesh?
  20. I have successfully created a scene and imported it, which shows up on my localhost, but when I put it on a live server (, I get an endless loading screen and this error in the console in Chrome: Uncaught SyntaxError: Unexpected token , e.SceneLoader.RegisterPlugin.load @ babylon.js:17u @ babylon.js:17e.onreadystatechange @ babylon.js:4 And this error in Firefox: SyntaxError: JSON.parse: unexpected non-whitespace character after JSON data at line 454 column 23 of the JSON data babylon.js:16:26015 Here is the code for the app <!DOCTYPE html><head> <title>3D Real Estate Application | Babylon.js version</title> <script src=""></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); scene.clearColor = new BABYLON.Color3(.25, .181, .240); // create a FreeCamera, and set its position to (x:0, y:5, z:-10) var camera = new BABYLON.FreeCamera('camera1', new BABYLON.Vector3(0, 0,13), scene); // target the camera to scene origin camera.setTarget(BABYLON.Vector3.Zero()); // attach the camera to the canvas camera.attachControl(canvas, false);BABYLON.SceneLoader.Load("", "realestate.babylon", engine, function(newScene){ if (!newScene.activeCamera) { newScene.activeCamera = new BABYLON.FreeCamera("Camera", new BABYLON.Vector3(3, 2,0), newScene); } newScene.executeWhenReady(function() { newScene.activeCamera.attachControl(canvas); // Once the scene is loaded, just register a render loop to render it engine.runRenderLoop(function() { newScene.render(); }); }); }); // return the created scene return scene; }; // call the createScene function var scene = createScene(); // run the render loop engine.runRenderLoop(function(){ scene.render(); }); // the canvas/window resize event handler window.addEventListener('resize', function(){ engine.resize(); }); }); </script></body></html>I have also attached a screenshot of what is supposed to appear in the browser. I wanted to make sure it wasn't something in my code that is causing this. Thank you for your help.
  21. I am trying to test a scene I created in Blender, but I keep getting the following error. "Uncaught TypeError: Cannot read property 'attachControl' of undefined" Here is my code: if (BABYLON.Engine.isSupported()) { var canvas = document.getElementById("renderCanvas"); var engine = new BABYLON.Engine(canvas, true); BABYLON.SceneLoader.Load("", "realestate.babylon", engine, function (newScene) { // Wait for textures and shaders to be ready newScene.executeWhenReady(function () { // Attach camera to canvas inputs newScene.activeCamera.attachControl(canvas); // Once the scene is loaded, just register a render loop to render it engine.runRenderLoop(function() { newScene.render(); }); }); }, function (progress) { // To do: give progress feedback to user }); }I have been away from Babylon.js for a little while, I figured I may have missed something, but I am not sure. I have searched to see if this has been a problem that has been solved. Any help you can give is much appreciated.Thank you.
  22. Taking advantage of the great new v3 architecture, I've created a plugin for importing Tiled maps. You can get it through npm: npm install pixi-tiledThe github repo is here. It's fairly basic for now, but it handles layers, tilesets (including multiple tilesets per layer), and uses the new loader middleware system to make it super easy to use. I've tried it with a couple of my own maps, and it works great, but i'm really keen to get people to try it with their own maps to I can start ironing out all the inevitable edge cases. If you have any feature requests please raise a github issue and I will do my best to implement them. Thanks for looking!
  23. Hi! I'm currently working with a project where I decided to use babylon.js, and is a newbie on the framework. I have imported a BIM-model which consists of hundred of meshes into babylon, and wondered if there is a way to check collisions for all these meshes without have to get each mesh by name, var mesh = getMeshByName("meshName"); and then assign it mesh.checkCollisions = true;Is there a way to loop through all the importet meshes without getting them by name?
  24. Hi, can someone advise me on how to import the babylon file into blender. The blender plugin for babylon only has exporter.
  25. Hi, I have some models in the fbx and obj, and i want to convert them into babylon.js custom format, can anyone help me on this ? am novice in the blender and tried to convert it with the given exporter, it works but the textures and camera, lights are missing, so am struggling, can you help me pls ? Actually am having more than 20 models , which i want to show them in my website, so i decided to show them with the babylon.js, and tried online converter to convert my model and converted them successfully, but i can't import them into my babylon scene, i can't see any models on the scene some said on this forum your model may doesn't have light,camera and so on, so i tried to fix it using blender, so i imported my fbx, obj models using blender importer and i tried my level my best, unfortunately am novice in blender so i can't And finally here i want some one who can convert my models into working babylon format, anyone do it for me ? else given me better tutorial ,etc Note: That i tried all the three converters which i found for the babylon 1. Online - not working to my models (light, camera,texture issues) 2. Blender, 3ds max- not working (am novice on this) 3. Command line converter - getting same result as online converter Thanks in advance..