AndyBeaulieu Posted November 29, 2013 Share Posted November 29, 2013 First off, thanks for all of the great work on Babylon.js - I have had a lot of fun playing with it over the past week. I am having an issue with disappearing meshes, as shown in this video: http://www.youtube.com/watch?v=JTKbvFSBs_0&feature=share&list=UUjW3rmSx2bXeUnFcN4o-yOw It looks like some kind of culling issue, but with the position of the camera I don't think it should be hiding the meshes? The issue occurs with both a FreeCamera and an ArcRotateCamera, but it seems worse with the FreeCamera. In the scene I am creating a bunch of Meshes with different y value (elevation) data and giving them a texture for the surface. Are there any ideas given this, or can I provide more information? Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted November 29, 2013 Share Posted November 29, 2013 Uhuh!! Interesting:) Could you share your code so that we can test it? Quote Link to comment Share on other sites More sharing options...
AndyBeaulieu Posted November 29, 2013 Author Share Posted November 29, 2013 (by the way I hope to get all of this cleaned up and write a nice tutorial on Babylon !) This problem took awhile to narrow down, but I found that:I was using an async ajax call to get elevation data from a server for a whole bunch of separate meshes (64 or more "tiles")in the ajax success, I was creating a new mesh and setting vertices, computing normals, etc. to get a mesh with elevation formedif I change the method to ajax call to synchronous (async: false below), then the issue goes away.if I leave the method as async (the default) then the issue with disappearing meshes comes back.So this is kind of bizarre, as JS is single-threaded so there can't be thread safety issues in Babylon or anything. I'll keep playing with how I do this but let me know if you have any ideas. // this is really just pseudocode !! $.ajax({ url: "/api/proxy/GetElevations", data: JSON.stringify(query), type: "POST", meshName: meshName, async: false, dataType: "json", contentType: "application/json; charset=utf-8", success: function (result) { var data = JSON.parse(result); // create a ground with elevation // create new BABYLON.Mesh(name, scene); // set vertices data and compute normals } }); Quote Link to comment Share on other sites More sharing options...
davrous Posted November 29, 2013 Share Posted November 29, 2013 Hey! Cool to see that Andy Beaulieu is playing with Babylon.JS! It's indeed very weird that switching to synchronous is solving the problem. BabylonJS is handling the asynchronous building of texture for you and injecting new meshes on the fly shouldn't be a problem. If you could share the code indeed with David and I, it will help a lot for the debugging job. Thanks. David Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted November 30, 2013 Share Posted November 30, 2013 Could you try to call mesh._updateBoundingInfo(); to force an update of the bounding boxes? Quote Link to comment Share on other sites More sharing options...
AndyBeaulieu Posted November 30, 2013 Author Share Posted November 30, 2013 Thanks David, calling _updateBoundingInfo worked like a charm! Obligatory fixed video - http://www.youtube.com/watch?v=0S08faz1JpE&feature=youtu.be Of course I have another question now, I'll start a separate thread though, as it is unrelated. GameMonetize 1 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.