wowserhq / wowser

World of Warcraft in the browser using JavaScript and WebGL
MIT License
246 stars 63 forks source link

Set up skeletons and animations #51

Open timkurvers opened 9 years ago

fallenoak commented 8 years ago

I'm a bit unclear if this line is correct: https://github.com/timkurvers/wowser/blob/master/src/lib/pipeline/m2/index.js#L116

this.skinData.submeshes.forEach((submesh, id) => {
...
  rootBones.forEach((bone) => {
    mesh.add(bone);
  });
...
});

It seems to me that mesh.add() is going to keep changing the parent submesh of each root bone each time a different submesh is iterated over in the parent (submeshes) forEach. That doesn't sound right to me. Why add to something if it's going to be overwritten immediately?

Is the rootBone property of the submesh entry a pointer to the correct bone index to add to the mesh? I gave that a shot and it deformed the Northrend Penguin skeleton in a weird way. I don't really understand the difference between rootBone and startBone in the submesh definition from the M2, though.

timkurvers commented 8 years ago

That's totally true, didn't think about that. I suppose binding the skeleton to the submesh is enough?