Jump to content

How to update values of a scene without stop the render loop


DellaFree
 Share

Recommended Posts

Hi guys :D

I would ask you a question:

is there a way to update some value of mesh (i.e a ground) without stop the engine and restart again?

I try to explain better :

I use this peace of code 

$('#mapHeight').slider({        value: 0,        min: 50,        max: 200,        slide: function (event, ui) {            MAP_HEIGHT = ui.value;            engine.stopRenderLoop();            startBabylon();        }    });

I set the global variable MAP_HEIGHT; it is used in this function :

var ground = BABYLON.Mesh.CreateGroundFromHeightMap("ground", 'texture/heightMap.png', 800, 800, 100, 0, MAP_HEIGHT, scene, false, null);

Then I stop the renderLoop (the variable engine is global) and call the function that start all the scene (startBabylon(); ). In this way when the scene is created, I will use the vaue updated.

It works, but every time I change the value with the slider, I stop the engine and start again , but ,for a fraction of second, I notice that the scene is loading (with a grey screen); so I would know if there is a way to update this value without stop the engine and make it more "fluid".

Or there is another way to do this?

Many thanks guys !

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...