Trouble getting meshes to play well together

Blitz3D Forums/Blitz3D Beginners Area/Trouble getting meshes to play well together

Trek(Posted 2011) [#1]
I don't know how to ask my question other than to explain what I'm trying to do. I created a mesh guy in Blender, and put a bone in his hand called "weapon". I also created a mesh sword for him. When he is equipped with the sword, I simply positionentity(sword) onto the weapon bone, and rotateentity(sword) to the rotation of the weapon bone. This works perfectly and looks as if he's carrying the sword throughout all his animations.
Next, I've tried to equip him with gloves, but the gloves are big and they cross a joint (his wrist). To solve this problem I thought to add two bones to the glove, to mimic the two bones on the man (forearm and hand bones). I entityposition and rotate the forearm glove bone to the forearm man bone (as with the two hand bones), just like I did with the sword, but the results are completely different. The glove is warped, stretched, and sometimes 90+ units away from the man's hand.
What's going on, or is there a better way of doing this? The only difference I see is that in the sword case I'm "attaching" a mesh to a bone of a mesh, and in the second case I'm "attaching" a bone of one mesh to a bone of another mesh. I hope this makes sense.


Warner(Posted 2011) [#2]
I am no modeler, so just my 2p. Why don't you use EntityParent to attach the sword to the hand's bone? After that, you can use "PositionEntity sword, 0, 0, 0" and "RotateEntity sword, 0, 0, 0" and the sword will follow the hand's animation automatically.

In the second case, that sounds like a cloth problem. You could do it like this:
1. Create an animated human, using bones
2. Export human as .b3d
3. Delete human, keep wrist and hand bone + their animations
4. Create a glove, using existing wrist and hand bone
5. Export glove as .b3d
In Blitz3D, load them both, and use the same Animate commands on both meshes.


Trek(Posted 2011) [#3]
Parententity works too, I just did it the other way because I'm new and it's the first thing I thought of...I thought about syncing up the animations like you suggested, but the problem with that is my animation commands for my human throughout the program have variable transition speeds (number of frames). If I wanted to sync them up I'd have to go find each animation command and find how many transition frames I used, otherwise the transition between one animation and another wouldn't be correct. In hindsight, maybe I shouldn’t have written my game like this, but I'm new so I'm cutting myself some slack.


jfk EO-11110(Posted 2011) [#4]
You can set the animation frame of one animation to the current animation frame of an other animation (well both with the same bones etc.). I am doing this with an NPC clone that is painted white and positioned offscreen to render some shadows. (Because I need to hide it frequently, and Hiding resets the animation). Although, Transitional poses cannot be copied this way, only poses that are stored as animation frames.

A further problem you'll have to fight is: You can rotate and move bones manually, yes, but the vertices will be unweighted, meaning each vertex will be bound only to its most significantly bound bone. Esp. with clothes that are making use of vertex weighting this will look rather imperfect.

When you position things and it doesn't work, always make sure you did not positon it locally where a global position was meant ot be (see optional parameter). I am sure it isn't that easy to position and rotate 2 bones of one mesh like 2 bones of an other mesh and get the vertices being deformed correctly automaticly. Most important, first align the ellbow bone, then the hand (due to hierarchy). Again the vertex weighting could make problems here as well.

I think you want your NPC being able to pickup many diffrent weapons, and you don't want to load the entire NPC with the weapon and or glove? As a rather sophisticated solution you may think about to use some real physics, clothes simulation for the glove. I guess this would look really nice.


MCP(Posted 2011) [#5]
If you've tried any of the solutions above but you're still having problems with glove/hand deformation another solution could be to make the lower arms interchangable parenting to the upper arm at the elbow or lower down towards the wrist (near the edge of the glove). Both the bare hands and the gloved hands will be boned and animated in exactly the same way performing the same range of movements.
It's more work on the modelling/animating side but the results should be satisfactory.