Hi folks!
My idea is having a mesh without skin and
find the nearest bone and apply it skin from that specific joint. I have
two diferents approaches
1st approach: get the xform translation in wordlspace as vector variable for each joint in the scene and compare the results
with one mesh, get the more closets values between them and pick that joint
vector $sphere = `xform -q -ws -scalePivot "pSphere1"`;
string $joints[] = `ls -type "joint"`;
vector $jointPos;
int $size = size($joints);
for ($obj in $joints)
{
for($i = 0; $i < $size; $i++) {
vector $jointPos = `xform -q -ws -scalePivot $obj`;
print ($jointPos + "\n");
}}
And I missing the way to match the most closet result between $spehere $jointPos
I was traying with something like this but there is not enough ($i = 0; $sphere <= $jointPos; $i++)
////////////////////////////////////////////////////////////
2nd approach: Using the mag function and then look the more closest to 0 but I cannot find the way to find wich
joint gave the more lower result
vector $sphere = `xform -q -ws -scalePivot "pSphere1"`;
string $joints[] = `ls -type "joint"`;
for ($eachJoint in $joints)
{
for($i = 0; $i < $size; $i++) {
vector $jointPos = `xform -q -ws -scalePivot $eachJoint`;
float $mag = mag ($sphere - $jointPos);
print ($mag + "\n");
}}
I really hope some of you can help me with this
! I googled a lot but I am lost