Fedor Posted June 2, 2017 Share Posted June 2, 2017 Hi, What I am trying to do here is a bit too complex to simulate it in a playground. I hope i can explain it. I have a mesh that was build from raw vertices and polygon data. I have added the bones weights and indices. I am sure these two arrays are fine, they come from the same original model as the vertices and polygons. I have checked this too. // The code to add the indices and weights to the mesh base_model.mesh.setVerticesData(BABYLON.VertexBuffer.MatricesIndicesKind, base_model.bonesIndices, true); base_model.mesh.setVerticesData(BABYLON.VertexBuffer.MatricesWeightsKind, base_model.bonesWeights, true); I then load a skeleton - also from the same origin, so the bones indices match those in the indices array. The skeleton is attached to the mesh. When I rotate bone #0, the entire mesh rotates accordingly. No surprises there, and to me this is proof that the weights and indices are effective. when I scale the bones, parts of the body also scale. Now, when I rotate bone#1- upper leg -, nothing at all happens. And nor does rotating the other bones have any effect. //The rotation command I use: rig.bones[1].rotate(BABYLON.Axis.X, .01, BABYLON.Space.WORLD, base_model.mesh); screenshot #1: you can see the bone rotates, but the mesh does nothing. screenshot #2: this is the original model, that does rotate the leg with the bone. screenshot #3: rotating bone #0 rotates the entire model. I know I am doing something strange here, but I assure you it is necessary to the application I am working on. I hope any of you have some suggestions where to look for an answer. Quote Link to comment Share on other sites More sharing options...
Fedor Posted June 2, 2017 Author Share Posted June 2, 2017 I noticed something interesting: when iterating through all the bone indices and set the first of every four indices to 1, the entire mesh is deforming (messy but that was to be expected.) So I checked if there were no #1 indices in there at the start, but there are, and they do have significant weight. I then tested rotating some other bones, and quite a few of them do get the mesh deformed... Quote Link to comment Share on other sites More sharing options...
adam Posted June 2, 2017 Share Posted June 2, 2017 I would get a very simple 2 bone model working the traditional way and then recreate it using the technique you are using now. You should then be able to identify what is going on by comparing the two meshes. It will also be much easier to put this on the PG so that others can play with your code. Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted June 2, 2017 Share Posted June 2, 2017 I would really love to help but we clearly need a small repro Quote Link to comment Share on other sites More sharing options...
Fedor Posted June 4, 2017 Author Share Posted June 4, 2017 Hi DK & rest, I figured it out... it had something to do with that other question: Once I detected a callback was broken somewhere in the middle, I was well on my way fixing it. It now works. GameMonetize 1 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.