I can take the last node specified in the tree before the NiTriShape, but that doesn't really seem correct. If I try that, it was still rotated incorrectly).jhooks1 wrote:Looks good. Doesn't the head have a parent NiNode/Bone you can connect it to?
I imagine something a little more complex is at work. AFAIK, xskinnpc.nif is actually clothing that characters wear. The body and head are separate sections, so there's probably something else the engine uses to figure out where the head trishape goes.
I'm again left to wonder if each NiTriShape should be a separate mesh/entity instead of a sub-mesh/sub-entity. As long as each mesh entity is connected to the correct bone of a root mesh/skeleton, it should behave largely the same but with the extra flexibility of being able to move each trishape independently by connecting its nodes to something else. Connect the nodes of the child entity (and any skeleton it may have) to the root entity's skeleton, and animating the root skeleton will implicitly animate the child.
This will need a bit more "book keeping" for certain types of in-game objects since you're now dealing with a hierarchy of entities instead of just one, but it seems a better fit from how this stuff is laid out.
Alternatively, we might be able to get away with rewriting the submesh's vertices/normals and bone assignments once when it needs to connect to something else, though there could be bounding box and collision issues with that.
Yes, though I wasn't really concerned about that at the time. What's there was good enough to get something working, even if some of the movements may be a little jerky. I can try doing something a bit better now, though.At time .5 I believe your code would pick quat2 as the rotation value, and trans1 as the translation.
Shouldn't the translation picked instead be a value between trans1 and trans2 (An interpolation?)