satguru Posted February 14, 2016 Share Posted February 14, 2016 I have a .babylon file containing a mesh and a skeleton (with animation) I load the mesh and skeleton into a scene, twice, using the SceneLoader ImportMesh() function. So now if I have a scene with two mesh and two skeleton. If I play animation on one skeleton it only animates the mesh it is attached to. So far so good Now I serialize the scene and save it to a file. I load the scene using the SceneLoader Load function. I play animation on one skeleton. Both the meshes are animated. !! I think the issue is that, unlike mesh and bones, skeletons do not have a uniqueId. In a serialized scene, meshes have references to skeleton ids and that skeleton id not unique. I think we should have uniqueId for each skeleton instance and when the scene is serialized the mesh should be serialized referencing their skeletons uniqueId. Quote Link to comment Share on other sites More sharing options...
satguru Posted February 15, 2016 Author Share Posted February 15, 2016 For now to get around this issue, just before I serialize the scene, I set the value of each skeleton id to a unique string. Another thing I notice is that the engine does not remove artifacts which are no longer required. For example if I dispose off a mesh, the skeleton referenced by that mesh is still retained even though it is not referenced by any other mesh. Same thing with textures , material etc. It might be a good idea to provide an serialization option to cleanup or "garbage collect" any orphaned , unreferenced item. Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted February 15, 2016 Share Posted February 15, 2016 Please contribute this is an open source framework Regarding skeletons, they do have an id:https://github.com/BabylonJS/Babylon.js/blob/master/src/Bones/babylon.skeleton.ts#L16 It is supposed to be unique. Can you check what value do you have in your serialized scene for this id? For auto-disposing, this is on purpose as Babylon.js cannot know if you want (or know) to later reuse the skeleton. But I agree with you this could be great to check it at serialization time Quote Link to comment Share on other sites More sharing options...
satguru Posted February 15, 2016 Author Share Posted February 15, 2016 I will definitely look into contributing. Right now I am just enjoying using Babylon. Skeletons have "Id" but they do not have "uniqueId" . "Id"s can assigned by user and can be duplicate. "uniqueId", I think, are internally generated. AbstractMesh, Bone, Camera and Light all have "uniqueId" which they inherit from Node. http://doc.babylonjs.com/classes/2.3/Node#uniqueid-number. I could look into adding an option for serialization. Cleaning up skeleton should be easy , as they are only referenced by mesh - right ? What about textures ? They are referenced just by materials ? and materials themselves ? mesh, particles ...? Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted February 16, 2016 Share Posted February 16, 2016 Quote Cleaning up skeleton should be easy , as they are only referenced by mesh - right ? Correct Textures should be already deleted (because of memory pressure) when not referenced. Materials are only referenced by meshes Regarding your bug: if the scene was loaded from a .Babylon then skeleton.id should be already unique. 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.