(06-15-2013 02:53 PM)Rofar Wrote: I'm a little confused about why it's even necessary to rename the standard Biped bones to esenthel bone names. The standard biped is supported in the engine. Also, I just set up my character game objects to allow me to specify the bone names in the rig that correspond to the esenthel standard bones and when the character is created in the world, the translation is done. This way I can essentially use any rig and make it work by setting the name in the object for the character.
Maybe someone can enlighten me as to why I should be using rigs that match the esenthel standard bones?
I was asked to provide some more detail regarding this. This is how I've implemented specifying non-standard bone names.
I create a string parameter in the character object parameters for each bone (bone arm_lu, bone arm_ru, bone body, bone body_u, etc). If I have a model with a skeleton that is not standard biped names, I can specify the bone name that corresponds to each Esenthel bone.
In my character class, I have a function to get the bone index for a given bone name:
Code:
int BaseCharacter.GetBoneIndex(Str name)
{
if(Param *param=obj().findParam(name))
{
Str boneName = param->asText();
Str8 c = boneName;
if (boneName.is())
{
return cskel.findBoneI(c);
}
}
return -1;
}
And one to get all the bone indexes and set them in the sac.
Code:
void BaseCharacter.SetBoneIndexes()
{
int boneIndex = GetBoneIndex("bone head");
if (boneIndex >= 0)
sac.head = boneIndex;
boneIndex = GetBoneIndex("bone neck");
if (boneIndex >= 0)
sac.neck = boneIndex;
boneIndex = GetBoneIndex("bone body");
if (boneIndex >= 0)
sac.body = boneIndex;
boneIndex = GetBoneIndex("bone body_u");
if (boneIndex >= 0)
sac.body_u = boneIndex;
boneIndex = GetBoneIndex("bone arm_lu");
if (boneIndex >= 0)
sac.arm_lu = boneIndex;
boneIndex = GetBoneIndex("bone arm_ru");
if (boneIndex >= 0)
sac.arm_ru = boneIndex;
boneIndex = GetBoneIndex("bone leg_lu");
if (boneIndex >= 0)
sac.leg_lu = boneIndex;
boneIndex = GetBoneIndex("bone leg_ru");
if (boneIndex >= 0)
sac.leg_ru = boneIndex;
boneIndex = GetBoneIndex("bone leg_ld");
if (boneIndex >= 0)
sac.leg_ld = boneIndex;
boneIndex = GetBoneIndex("bone leg_rd");
if (boneIndex >= 0)
sac.leg_rd = boneIndex;
boneIndex = GetBoneIndex("bone hand_l");
if (boneIndex >= 0)
sac.hand_l = boneIndex;
boneIndex = GetBoneIndex("bone hand_r");
if (boneIndex >= 0)
sac.hand_r = boneIndex;
boneIndex = GetBoneIndex("bone foot_l0");
if (boneIndex >= 0)
sac.foot_l0 = boneIndex;
boneIndex = GetBoneIndex("bone foot_r0");
if (boneIndex >= 0)
sac.foot_r0 = boneIndex;
}
Then I call SetBoneIndexes in the create function after super.create and in the load function.
I only set these bone parameter values if I have a model that I cannot rename the bones on. If possible, I will just use standard biped bone naming or rename to the standard names.