Jump to content

Search the Community

Showing results for tags 'Import Export Meshes Scenes'.

  • 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. Sorry folks here I am again doing strange things and getting strange (to me) results. What follows are descriptions of: what I am trying to do; how I am trying to do it; the issues that arise; the code I am trying with demo in playground; other thoughts and attempts; why I am trying to do it (for those interested in why I do these weird things); I fully expect that those who get as far as 2 will tell me I am going about it the wrong way and I should be doing X, Y, Z not A, B, C to achieve 1. In which case I will do X, Y and Z. 1 What I am trying to do I create two scenes, sceneA and sceneB, using the same engine and canvas but containing different meshes. I start by viewing sceneA. At some point I want to swap from sceneA to sceneB transferring some but not all meshes from sceneA to sceneB and then viewing sceneB. Thanks to RanaanW I can export a scene from one program and then read from it a saved mesh into a different program. I want the above to happen within one program (webpage). 2 How I am trying to do it. Basically create meshes in sceneA and then sceneB and render sceneA. Then on swap push the required meshes from sceneA to sceneB.meshes; stop rendering sceneA start rendering sceneB 3 The issues that arise In sceneA I create a blue box and a green box. In sceneB I create a red box. When I push two boxes into sceneB.meshes the materials of the two boxes are transferred. green and blue boxes from sceneA added to red box of sceneB However when I only push one box into scenB.meshes the material of the box picks up the red material from sceneB only green box from sceneA added to red box of sceneB The other issue is that in both cases I can move the camera in sceneB but only the red box originally created in sceneB responds to the camera movement. 4 The code I am trying with demo in playground function onswap() { sceneB.meshes.push(box0); sceneB.meshes.push(box1); engine.stopRenderLoop(); // Register new render loop to repeatedly render the sceneB engine.runRenderLoop(function () { sceneB.render(); });}In the playground the swap is carried out by clicking on the 'Frames Per Second' counter. ***********************************************WARNING *************************************************** After clicking on the fps counter YOU MUST REFRESH the webpage before RUNning it again. Any major changes you might make should be saved before RUNning. ************************************************WARNING *************************************************** //click playground fpLabel to switch scenesdocument.getElementById('fpsLabel').addEventListener("click", function () { sceneB.meshes.push(box0); sceneB.meshes.push(box1); engine.stopRenderLoop(); // Register new render loop to repeatedly render the sceneB engine.runRenderLoop(function () { sceneB.render(); });}, false);The demo 5 Other thoughts and attempts I have tried transferring sceneA.materials to sceneB.materials but perhaps I got this wrong. I have thought about reading the data from a mesh including type (box, sphere, cylinder etc), position, rotation, material etc and then using BABYLON.Mesh.Create....... to reconstruct the mesh in sceneB but if there is a lazy way of doing it, like using sceneB.meshes then I am all for it. 6 Why I am trying to do it I am at the beginning of a project that is attempting to do the following. In sceneA construct a 'model' using basic BJS elements (Think children's building blocks). When the model is completed switch to sceneB and add the finished model to sceneB. The basic thinking is that sceneA is a model construction site and sceneB is where the models are combined to make scene. For example in the construction site you could build different dwellings, benches, fences, trees etc that can then be added to the main scene.
×
×
  • Create New...