So I have a model with the head and body separate (due to the art pipeline I’m grabbing assets from), and would like to combine the two as a multi-part actor. However, I’m having trouble getting the Attach() call to work properly:
I imported the two models and used egg-optchar to expose a the neck joint on both (“jtNeck”). Here is the code written to create the actor:
I can’t tell the parenting from your post, since without the code tags the indentations are lost.
One question that leaps to mind is whether you have stripped the neck animation off the head. Since the head will be parented to the neck joint from the body, it’s important that the head not contain any neck animation of its own: that is, if you load up the head and play it by itself, it should be sitting on the ground, at the origin, and not moving. If it’s bobbing around at 5 feet or so, you’ve still got the neck animation, and you’ll end up doubling that animation. Use egg-topstrip to remove the animation if necessary.
If you can load, say, smiley.egg, and parent him by hand to your exposed neck joint, and he shows up on the shoulders, then the neck joint on the body is good.
Finally, if you can parent the head to the neck joint by hand and it comes out right, then you’re probably in a good situation, and something in the Actor code is getting it wrong.
If all else fails, if you post your egg files where I can download them, I may be able to give you more specific advice.
The head is holding still but it’s origin is well below the neck (so that if I setPos(render,0,0,0) the head and body independently the head will be in the “correct” position to the head).
However, the way the multi-part animation manual is written, I thought the head’s joint that was in common with the body would be attached to the body’s joint (so that the head’s jtNeck would be attached to the body’s jtNeck). If that is not the case, is it just the .egg’s origin attached to the joint?