THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 03/06/2003 at 02:25, xxxxxxxx wrote:
User Information:
Cinema 4D Version: 7.3
Platform: Mac ;
Language(s) : C.O.F.F.E.E ;
---------
Hi, I'm trying to 'boxify' a skeleton, by importing a BVH, then running my plugin to put cubes into bones, thus creating a 'box skeleton', moving as the bone skeleton moves....
I've hit an early snag - can't get the position of an inserted cube to match the bone. I'm using my own code (that works in other plugins) and what I found by searching the archive here.
My version is:
makeObjectGlobalPointLocal(point,object)
{
var oM = object->GetMg();
oM->Invert();
point = oM->GetMulP(point);
return point;
}
makeObjectLocalPointGlobal(point,object)
{
var oM = object->GetMg();
var oGV = oM->GetV0();
point = oM->GetMulP(point);
return point;
}
... and what I found here:
// Matrix -> PSR
GetMatrixPosition(mat)
{
return mat->GetV0();
}
GetMatrixRotation(mat)
{
return mat->GetHPB();
}
GetMatrixScale(mat)
{
return vector(vlen(mat->GetV1()),
vlen(mat->GetV2()),
vlen(mat->GetV3()));
}
// PSR -> Matrix
SetMatrixPosition(mat,pos)
{
mat->SetV0(pos);
}
SetMatrixRotation(mat,rot)
{
var temp=mat->GetV0();
mat->SetRotHPB(rot);
mat->SetV0(temp);
}
SetMatrixScale(mat,scale)
{
mat->SetV1(vnorm(mat->GetV1())*scale.x);
mat->SetV2(vnorm(mat->GetV2())*scale.y);
mat->SetV3(vnorm(mat->GetV3())*scale.z);
}
... the odd thing is that when I do the calculations, the printout to the console reads both the bone and the inserted cube as same position point. But in the viewport the cube is offset from the bone. The further the bone is from 0,0,0 the greater the offset. The bone is disabled and there's no difference if I alter its settings. What's wrong?