On 13/12/2014 at 12:26, xxxxxxxx wrote:
User Information:
Cinema 4D Version: 16
Platform: Mac ;
Language(s) : C++ ;
---------
hey
i try to calculate a rotation from a object and get the opposite to an other object
sourceMagnet = the source object
targetMagnet = the object witch should be on the opposite side of sourceM
selected object is a parent of targetMag witch take the rotation
I can`t find my error - have one a tip please
Vector rotTarget = MatrixToHPB(targetMagnet->GetMg(), ROTATIONORDER_HPB);
Vector rotSource = MatrixToHPB(sourceMagnet->GetMg(), ROTATIONORDER_HPB);
Vector rotdif = rotSource-rotTarget;
if (rotdif.x > 0){
rotdif -= Vector(Rad(180.0),0,0);
}else{
rotdif += Vector(Rad(180.0),0,0);
}
selectedObject->SetRotationOrder(ROTATIONORDER_HPB);
selectedObject->SetAbsRot(selectedObject->GetAbsRot()-rotdif);