Jump to content

Search the Community

Showing results for tags 'sceneLoader importMesh'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • HTML5 Game Coding
    • News
    • Game Showcase
    • Facebook Instant Games
    • Web Gaming Standards
    • Coding and Game Design
    • Paid Promotion (Buy Banner)
  • Frameworks
    • Pixi.js
    • Phaser 3
    • Phaser 2
    • Babylon.js
    • Panda 2
    • melonJS
    • Haxe JS
    • Kiwi.js
  • General
    • General Talk
    • GameMonetize
  • Business
    • Collaborations (un-paid)
    • Jobs (Hiring and Freelance)
    • Services Offered
    • Marketplace (Sell Apps, Websites, Games)

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 1 result

  1. Have read done the searching and found and followed the examples but am missing something that is probably pretty obvious. I have created a scene and used var serializedScene = BABYLON.SceneSerializer.Serialize(scene);var strScene = JSON.stringify(serializedScene);to create a JSON file testbox.babylon From what I have gathered the code below should extract the mesh named "box0" and import it into the scene I created. The created scene works fine, the ground appears and rotates as expected with the pointer. The import appears to be successful since console.log(mesh[0])gives Object { state: "", animations: Array[0], _childrenFlag: -1, _isEnabled: true, _isReady: true, _currentRenderId: 36, _parentRenderId: -1, name: "box0", id: "box0", _scene: Object, 74 more… } However the box does not appear in the scene. //Set Scenevar canvas = document.getElementById("canvas");var engine = new BABYLON.Engine(canvas, true);var scene = createScene(engine,canvas); //Create Materialsvar blueInMat = new BABYLON.StandardMaterial("blueIn", scene);blueInMat.emissiveColor = new BABYLON.Color3(0.2,0.2,1); var redInMat = new BABYLON.StandardMaterial("redIn", scene);redInMat.emissiveColor = new BABYLON.Color3(1,0,0); //Create Ground var groundin=BABYLON.Mesh.CreateGround("groundIn",1200, 1200, 20, scene, false, BABYLON.Mesh.DOUBLESIDE); groundin.material = blueInMat; // Register a render loop to repeatedly render the sceneengine.runRenderLoop(function () { scene.render(); }); // Watch for browser/canvas resize eventswindow.addEventListener("resize", function () { engine.resize(); }); BABYLON.SceneLoader.ImportMesh("box0", "./", "testbox.babylon", scene, function (meshes, particleSystems, skeletons) { console.log(meshes[0]); //meshes[0].material = redInMat; console.log(meshes[0].material); });When the box did not appear I thought maybe it was because the material was not defined so added the redInMat material and set mesh[0] to this - to no avail. I have tried, Firefox, Chrome and IE all give the same result. What am I missing.
×
×
  • Create New...