ozRocker Posted July 23, 2016 Share Posted July 23, 2016 Just say you have a whole bunch of meshes in the scene and you want them to disappear out of view temporarily. Is it better to set the mesh to invisible or dispose the mesh then recreate it later? Which one is better for the frame rate? Quote Link to comment Share on other sites More sharing options...
gryff Posted July 23, 2016 Share Posted July 23, 2016 @ozRocker: there is another option oz : mesh.setEnabled(false); Which I tend to use as I have never been sure about what setting the visibility had on scene efficiency. And disposing of a mesh - if you need it again (ie. it is temporary state ) it has to be reloaded ? cheers, gryff Quote Link to comment Share on other sites More sharing options...
ozRocker Posted July 23, 2016 Author Share Posted July 23, 2016 ok cool, I did some tests on disposing and setEnabled(false). I'm walking through a scene that's split up like a grid which is 8,2,8 in size with 64 cubes in each tile. That's 8192 shapes in total As the player walks around new cubes will appear around them and the faraway cubes will disappear from view. When I dispose of the cubes then re-create them when the user walks through the same tiles then returns to the starting point of 0,0,0 the frame rate stays at mostly 60, with minimum of 58. If I keep the mesh in memory and use setEnabled(false) the framerate is mostly 60 but can flicker down to 55. The reason I'm doing these tests is because I'm lazy-loading objects from the server. I don't want to load massive a JSON packet of 8192 objects from the server then create all those meshes at once. I just want to load the objects in the tiles surrounding the player. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.