Currently we can't update animesh size and have to upload multiple versions of the mesh in different sizes, and upload all animations for each size.
I did some research in the viewer's code, and it appears to me that it's extremely easy to add a feature to adjust the global size of an animesh by modifying the llcontrolavatar.cpp file. Here is the current setGlobalScale() function:
void LLControlAvatar::setGlobalScale(F32 scale)
{
if (scale <= 0.0)
{
LL_WARNS() << "invalid global scale " << scale << LL_ENDL;
return;
}
if (scale != mGlobalScale)
{
F32 adjust_scale = scale/mGlobalScale;
LL_INFOS() << "scale " << scale << " adjustment " << adjust_scale << LL_ENDL;
// should we be scaling from the pelvis or the root?
recursiveScaleJoint(mPelvisp,adjust_scale);
mGlobalScale = scale;
}
}
And here is a modified version that currently takes into account the X size of the main prim:
Note that I replaced mPelvisp by mRoot because using mPelvisp does not correctly adjust the animesh's movement during the animation."
It works wonderfully. Of course, this modification as it stands could affect many existing animesh objects, so we need to add a parameter to the object, 'ANIMESH_SCALE_FACTOR', which would be set to 1 by default, adjustable via script and by manual editing of the object. We would then have something like this:
scale *= mRootVolp->getAnimeshScaleFactor;
Here is a gif, you can take a look, the 4 dogs are all the exact same animesh, I only changed there main prim X scale :
Currently we can't update animesh size and have to upload multiple versions of the mesh in different sizes, and upload all animations for each size.
I did some research in the viewer's code, and it appears to me that it's extremely easy to add a feature to adjust the global size of an animesh by modifying the llcontrolavatar.cpp file. Here is the current setGlobalScale() function:
void LLControlAvatar::setGlobalScale(F32 scale)
{
}
And here is a modified version that currently takes into account the X size of the main prim:
void LLControlAvatar::setGlobalScale(F32 scale)
{
}
Note that I replaced mPelvisp by mRoot because using mPelvisp does not correctly adjust the animesh's movement during the animation."
It works wonderfully. Of course, this modification as it stands could affect many existing animesh objects, so we need to add a parameter to the object, 'ANIMESH_SCALE_FACTOR', which would be set to 1 by default, adjustable via script and by manual editing of the object. We would then have something like this:
Here is a gif, you can take a look, the 4 dogs are all the exact same animesh, I only changed there main prim X scale :
https://gyazo.com/de2dc2904bcb4e6b8737514aa7db7d2c
https://secondlife.canny.io/admin/board/feature-requests/p/update-animesh-size-by-manual-edit-and-script