cricket Posted December 2, 2016 Share Posted December 2, 2016 Hello I am trying to serialize the scene with BABYLON.SceneSerializer.Serialize(scene) and am getting a "mesh.rotation.asArray is not a function". Serialization works fine when meshes are not rotated. On further exploration, I realised that that mesh.rotation was not a Vector3 object but an object with getters, setters and __op__: Observer. Could this be the issue? Can you please help me fix this. Please let me know if you need more details. Thank you Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted December 2, 2016 Share Posted December 2, 2016 Works for me: http://www.babylonjs-playground.com/#LP1HN Quote Link to comment Share on other sites More sharing options...
cricket Posted December 2, 2016 Author Share Posted December 2, 2016 @Deltakosh Thanks for the prompt reply. For further illustration, I have added following code to your playground to produce updated playground console.log(sphere.rotation) console.log(scene.meshes[0].name) console.log(scene.meshes[0].rotation) console.log(scene.meshes[0].rotation.asArray()) Note that both sphere.rotation and scene.meshes[0].rotation return Vector3 like objects with the following characteristics there are no getters and setters for x,y,z there is a method mesh.rotation.asArray() However, when I execute console.log(scene.meshes[2].rotation) with my scene, I get an object with following there are getters and setters for x,y,z but no asArray() method. A property {__op__: Observer}. Do you know what kind of object this could be? I must mention that I doing this for meshes loaded in .obj format. Could loading .obj be responsible for this? Is there a way for me to add assets to playgrounds (so that I can demonstrate the error)? Thanks Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted December 2, 2016 Share Posted December 2, 2016 This is interesting Can you load your obj (from dropbox for instance) in the playground to highligh this issue? You should be right, the object is probably not a mesh but perhaps an instance or a linemesh.. Quote Link to comment Share on other sites More sharing options...
cricket Posted December 4, 2016 Author Share Posted December 4, 2016 Sorry the issue was my fault. I was directly setting mesh.rotation = {x, y, z} obtained from a network request instead of using mesh.rotation = new Vector3(...) 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.