PHP Code:
for (int i = chainlength - 1; i >= 0; i--)
{
int bone = chain[i];
int parent = pbones[bone].parent;
QuaternionMatrix(q1[bone], bonematrix);
bonematrix[0][3] = pos1[bone][0];
bonematrix[1][3] = pos1[bone][1];
bonematrix[2][3] = pos1[bone][2];
R_ConcatTransforms((parent == -1) ? rotationmatrix : bonetransform[parent], bonematrix, bonetransform[bone]);
}
according to the code from REHLDS it seems "i" will reach out of bounds at -1 due the following condition.
Can some one prove otherwise ?
Btw this function "GetAttachment from r_studio.cpp" is so buggy i've tested it out multiple times and sometimes the results of the origin of the attachment get shifted randomly, any solutions on how to fix that?
__________________