ozRocker Posted May 5, 2016 Share Posted May 5, 2016 I have some players that are rigged but have no animations and I have a master animation file. I am cloning those animations to each new player as they appear in the scene. I'm using this kind of code to transfer the animation: this.mesh.skeleton = Assets.animator.skeleton.clone(JSON.idx); this.mesh.skeleton.copyAnimationRange(Assets.animator.skeleton, "Idle"); this.mesh.skeleton.copyAnimationRange(Assets.animator.skeleton, "Walk"); this.mesh.skeleton.copyAnimationRange(Assets.animator.skeleton, "Run"); "Assets.animator" is the mesh with the master animations. "this.mesh" is the new player. This process works fine but I'm having a problem with one player in particular. When I apply the run animation from the master into my player in Blender it looks like this: But in my Babylon.js scene it looks like this: It looks like something has happened to the bone weighting on the arm. Does anyone know how to fix this? Quote Link to comment Share on other sites More sharing options...
adam Posted May 5, 2016 Share Posted May 5, 2016 Make sure you don't have any positions or scaling that has not been applied to your model in Blender. Quote Link to comment Share on other sites More sharing options...
ozRocker Posted May 5, 2016 Author Share Posted May 5, 2016 31 minutes ago, adam said: Make sure you don't have any positions or scaling that has not been applied to your model in Blender. Yep, got that sorted. I apply position and scale to mesh and armature after I've done the process of clearing parent and re-parenting. Quote Link to comment Share on other sites More sharing options...
adam Posted May 5, 2016 Share Posted May 5, 2016 I'd try clearing all the vertex groups when re-parenting (remove parent, clear all vertex groups, then parent). Can you post a screenshot with the skeleton viewer turned on in the BJS debugger? Quote Link to comment Share on other sites More sharing options...
ozRocker Posted May 5, 2016 Author Share Posted May 5, 2016 29 minutes ago, adam said: I'd try clearing all the vertex groups when re-parenting (remove parent, clear all vertex groups, then parent). Can you post a screenshot with the skeleton viewer turned on in the BJS debugger? Ok, I cleared out the vertex groups before re-parenting but the end result was the same. Here's the skeleton from the debugger: Quote Link to comment Share on other sites More sharing options...
adam Posted May 5, 2016 Share Posted May 5, 2016 When you re-parented did you also check that rotation, location, and scale had been applied to the skeleton too? I had a similar issue with one of my models. Looked fine in Blender, but in BJS the skeleton did not line up with the mesh. Quote Link to comment Share on other sites More sharing options...
ozRocker Posted May 5, 2016 Author Share Posted May 5, 2016 34 minutes ago, adam said: When you re-parented did you also check that rotation, location, and scale had been applied to the skeleton too? I had a similar issue with one of my models. Looked fine in Blender, but in BJS the skeleton did not line up with the mesh. Yep, always making sure I apply the transformations. I made a playground where I have the exported babylonjs file but I bundled the animations with the mesh, instead of cloning and copying and the funny arm problem went away. http://www.babylonjs-playground.com/#1IGIDN I'll create another playground with the cloning to see if I can replicate the problem (Ignore the skipping frames for now. That happens with all my exports and I don't know how to get rid of it ) Quote Link to comment Share on other sites More sharing options...
ozRocker Posted May 5, 2016 Author Share Posted May 5, 2016 I fixed it!! Thanks Adam for your help http://www.babylonjs-playground.com/#29TMFL You can see the problem in the playground here. I shouldn't be copying the skeleton of the animator. When I get rid of that line it works properly Quote Link to comment Share on other sites More sharing options...
adam Posted May 5, 2016 Share Posted May 5, 2016 I see errors in the console when I comment out line 29. Maybe that isn't what you were referring to. Quote Link to comment Share on other sites More sharing options...
ozRocker Posted May 5, 2016 Author Share Posted May 5, 2016 14 minutes ago, adam said: I see errors in the console when I comment out line 29. Maybe that isn't what you were referring to. I don't know what's going on there. I just ignored it 'cos it doesn't happen on my server. 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.