Jump to content

Temporalily remove mesh from rendering list.


kolar
 Share

Recommended Posts

Hi, I am making a game with dynamic environment loading, I want to remove meshes (also skeletons) from rendering list temporalily so the mesh won't be dowloaded and parsed when it will be added to scene again. Do I need to write my own asset manager? What is the best way (babylon way) to store parsed meshes/skeletons/textures in memory? I know I can use indexeddb but I worry that frequent mesh parsing might be performance hit. Any advice?

Link to comment
Share on other sites

Welcome to the forum, Kolar!

 

All lights, cameras, and mesh, used in babylon.js, are of class NODE. http://doc.babylonjs.com/page.php?p=24620 .  That means that they inherit some properties and methods of NODE.  [AnySceneItem].setEnabled(1 or 0) might be of some interest to you.  I am just guessing, here.

 

Large 'groups' of scene items can be parented to a single (maybe invisible) mesh.  You could think of that mesh as a 'group controller'.  Toggle that parent.setEnabled(), and all children... get toggled as well.  In this way, you could enable/disable large chunks of scene... with a single setEnabled() call on an important parent or two.  Lights and cameras can be parents, too.  I do not know if any of this helps, but I thought you should know.  :)

Link to comment
Share on other sites

Yes, 'enabled' can be used too but it's only if you remove/push from/to the same scene whereas what I suggested allow you to push to another scene. I update my previous post to reflect this:

myOtherScene.meshes.push(myMesh);

kolar, you have several options, it depends on what you want to do. 

Link to comment
Share on other sites

Large 'groups' of scene items can be parented to a single (maybe invisible) mesh.  You could think of that mesh as a 'group controller'.  Toggle that parent.setEnabled(), and all children... get toggled as well.  In this way, you could enable/disable large chunks of scene... with a single setEnabled() call on an important parent or two.

 

 

@Wingnut: Can you set things like "checkCollisions" by using a 'group controller' for a number of meshes in this way? Will checkCollisions progate from parent to children?

 

@gwenael - pushing and popping meshes - got to play with that ;-)

 

cheers, gryff :)

Link to comment
Share on other sites

Gryff... that is a great question and an interesting idea, but I don't have an answer for you.  I have not studied collisions at all, speak nothing of how parent-child relationships might propagate collision events.  Others likely know, and if you do experiments in that, please tell us of your discoveries.  thx.

Link to comment
Share on other sites

Thank you for the answer, it makes things more clear for me.

How about removing skeletons? What happens to the skeleton when I remove mesh so there are no meshes affected by this skeleton. In other way, when I write:

BABYLON.SceneLoader.ImportMesh(null, "path", "some_model_with_skeleton.babylon", scene, function (meshes, particleSystems, skeletons) {	//skeletons[0] is attached only to meshes[0]	scene.beginAnimation(skeletons[0], 0, 30, true, 1.0);		scene.meshes.splice(scene.meshes.indexOf(meshes[0]), 1);});

Is animation still performing (sending transformations to gpu itd)? Do I need to remove skeleton manually:

scene.skeletons.splice(scene.skeletons.indexOf(skeletons[0]), 1);

And what happens to the skeleteon when I use second solution:

mesh.setEnabled(0);
Link to comment
Share on other sites

a great question and an interesting idea, but I don't have an answer for you.  I have not studied collisions at all, speak nothing of how parent-child relationships might propagate collision events.

 

 

 

Well, I created a little experiment - see the "Trigger Zones" thread for details.

 

cheers, gryff :)

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...