Dad72 Posted February 1, 2017 Share Posted February 1, 2017 Hello, I have a ground serialize with SerializeMesh() that I save in a babylon file. When I reload this file with ImportMesh: getHeightAtCoordinates, updateCoordinateHeights, optimize ... does not work. In fact everything concerning the ground create with CreateGroundFromHeightMap() or CreateGround() is serialized as mesh but can no longer be used as a terrain. We can only edit the properties on the mesh and not the geometry that no longer exists after serialization. May be missing a serialization for the ground, like serialiserGround() in addition to serializeMesh(). Or convert a mesh to ground after using ImportMesh for used getHeightAtCoordinates. Thanks DK Quote Link to comment Share on other sites More sharing options...
jerome Posted February 1, 2017 Share Posted February 1, 2017 I think that a de-serialized mesh is just a mesh, not a groundMesh. Maybe is there an elegant way in JS to give to the deserialized mesh all the groundMesh methods ? something like : deserializedGround.prototype = BABYLON.GroundMesh.prototype; Dunno ... Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted February 1, 2017 Share Posted February 1, 2017 Jerome is right. A groundMesh is deserialized as a regular mesh. If someone wants to step in to add this option (should not be too difficult) I'll be happy to review the PR Quote Link to comment Share on other sites More sharing options...
Dad72 Posted February 1, 2017 Author Share Posted February 1, 2017 I would be delighted to offer a PR, but I do not know what to change to add or make this option. Maybe @jerome knows what to do to add this and make a PR. Quote Link to comment Share on other sites More sharing options...
jerome Posted February 1, 2017 Share Posted February 1, 2017 no idea, sorry. Quote Link to comment Share on other sites More sharing options...
Dad72 Posted February 1, 2017 Author Share Posted February 1, 2017 2 hours ago, jerome said: DeserializedGround.prototype = BABYLON.GroundMesh.prototype; You said something like that, but I do not understand Quote Link to comment Share on other sites More sharing options...
Dad72 Posted February 1, 2017 Author Share Posted February 1, 2017 I think I understood nothing. When I do this, it does not work. newMeshes[0].prototype = BABYLON.GroundMesh.prototype; newMeshes[0].updateCoordinateHeights(); 2 hours ago, Deltakosh said: If someone wants to step in to add this option (should not be too difficult) If Jerome says has no idea, I think it's difficult. I do not even know what file to edit and what to add. Quote Link to comment Share on other sites More sharing options...
jerome Posted February 1, 2017 Share Posted February 1, 2017 I don't really know how to make typescript class inheritance in javascript actually Imho, the right way would be to make the de-serialized mesh inherit from the GroundMesh class. Quote Link to comment Share on other sites More sharing options...
Dad72 Posted February 3, 2017 Author Share Posted February 3, 2017 I can not find a solution for that. Quote Link to comment Share on other sites More sharing options...
Dad72 Posted February 3, 2017 Author Share Posted February 3, 2017 Well, I will change my method of creation and save for the terrain. ImportMesh does not load a terrain and serializeMesh, does not serialize a terrain. 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.