haestflod Posted March 19, 2017 Share Posted March 19, 2017 Hi I was using uniqueId to uniquely represent a mesh and I noticed if I use a cloned mesh ( mesh.clone() ) their uniqueId would be the same. After debugging the code the cloned mesh has a uniqueId after this line: super(name, scene); But after the line: Tools.DeepCopy(source, this, ["name", "material", "skeleton", "instances", "parent"], ["_poseMatrix"]); They now have the same uniqueId Which can be seen here:http://playground.babylonjs.com/#27FBML#0 Quote Link to comment Share on other sites More sharing options...
BitOfGold Posted March 19, 2017 Share Posted March 19, 2017 Yes, I had to patch this in my version since months. Cannon js collisions do not work on cloned meshes without this. (dirty hack :() BABYLON.Mesh.prototype.clone_h_ = BABYLON.Mesh.prototype.clone; BABYLON.Mesh.prototype.clone = function() { var m = BABYLON.Mesh.prototype.clone_h_.apply(this,arguments); m.uniqueId = m.getScene()._uniqueIdCounter++; return(m); }; Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted March 20, 2017 Share Posted March 20, 2017 Definitely a bug..This is fixed now 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.