Game Development Community

Skeleton issue for hero model

by Marvin Hawkins · in Torque Game Engine · 06/23/2005 (10:29 am) · 8 replies

I forget which chapter it is but there's a tutorial in the book for building and animating a 3d hero. i think chapter 14 but anyway the first couple of steps show you how to build the arm part of the skeleton, but the next steps says just place the other skeleton joints as shown in a diagram, the only problem is since the picture is so dark i can't tell if they're supposed to be connected. Should all the joints be connected (except for stuff like 'camera' and 'mount')?

The reason I ask is because when i tried to do the first steps in the animation example (on the page where the square jawed hero is taking a bow but the arms are still in the same place) I wasn't able to rotate the joint 'lower spine' because it was i'm guessing the only joint and was not connected to any others.

In one of the next figures i see an entire skeleton for the model.

#1
06/23/2005 (10:37 am)
If you're modeling in Milkshape 3D - yes, your skeleton needs to be connected with the exception of nodes (mounts, emitters, etc.)
#2
06/23/2005 (12:52 pm)
Marvin and Kirby,

Actually if you want the nodes (mounts, emitters, etc.) to move with the character through the animations, you will need to connect them with the appropriate parent joint. I.e. mount0 should be attached to the right hand joint.

Thanks.
#3
06/23/2005 (2:17 pm)
So Derek,

What you're saying is the camera node should be attached to the model?

What would happen if it wasnt and the character started to move?
#4
06/23/2005 (2:27 pm)
If you don't connect the camera node and the character moves, the camera node will follow the
player and move with them just as if it WERE attached.

What Derk was trying to explain was that if you ATTACH the camera node to the rest of the
skeleton, the camera node will move along with not just the player movements, but also the player's
ANIMATIONS (such as the breathing animation in the root pose)

Clear as mud? Allow me to try and give you an example:

Orc model, camera node disconnected from skeleton, when in first person mode standing still
the camera remains perfectly still, regardless of the orc's breathing animation. When the orc
runs, the camera moves along with it at a perfect level, unnafected by the running animation.

Bravetree GirlPack model, camera node connected to skeleton, when in first person mode
standing still the camera moves up and down along with the motion of the character's breathing animation. When the girl model runs, the camera bounces up and down with her head in
direct correlation to her running animation.
#5
06/23/2005 (2:36 pm)
There is one exception though; If you use ground transform (like when a character walk or run) the camera have to follow the character or it will lag behind in the game.
#6
06/23/2005 (3:31 pm)
Marvin,

No, the camera would be an exception. I was talking more about mount points and emitter points (as Kirby mentioned). If mount0 is not attached to the hand, when the arm moves up, the mount point would stay put. That would make the weapon in the hand float at a constant point irrespective of the players hand position.

If you are using ground transforms, you will want to attach the camera to the root bone or the camera will jump forward and back during the walk cycle (did this, not good). By selecting a bone that doesn't move very much will keep the camera "stable."

If you are not using ground transform, put the camera where ever you want :)

Thanks.
#7
06/23/2005 (3:41 pm)
Quote:did this, not good

Me too =)

You actually don't HAVE to link the camera. What I usually do (but I'm using 3d studio) to keep it stable is to not actually link it to anything but write a "script controller" that keeps it at the center of my character only on the back/forward axis. I assume you can't do that in milkshape though, but you could probably still animate the camera manually.
#8
09/16/2005 (12:13 pm)
A simple code change could be:
./game/shapeBase.cc
in: void ShapeBase::getCameraTransform(F32* pos,MatrixF* mat)
around line 1647
change:

mShapeInstance->mNodeTransforms[mDataBlock->cameraNode].getPosition(&osp);

static F32 fZ = 0.0f;
mShapeInstance->mNodeTransforms[mDataBlock->cameraNode].getPosition(&osp);
if ( fZ == 0.0f )
     fZ = osp.z;
else
     osp.z = fZ;

This should basically copy the z position of the camera position the first time in, and copy it back every other time.
Further calculations are made elsewhere to reposition it yet again based on the object's world position.

You can make this more complicated and script friendly if you wish, by adding datablock changes to the code to decide in script whether or not this is done on any object on an individual basis.