Hi again, i step into another problem. i have setup the leg, but when i apply a rotation to any link, it seems to be, the leg is rotated around the origin point of the scene (0,0,0). one thing, that gets me confused is, that in my understanding it should rotated around the local coordinate system, not the global. if not, ok, one solution would be, to translate the object to the origin and after the rotation is applied, translate it back. to do such an operation, i require the global translation matrix of the given link. but when i call: Matrix tempTrans = linkTransformNodes[1]->getToWorld(); it returns the identity matrix. any ideas how i can get the global translation matrix? on the other hand, i wonder if there is a way to move the pivot point of an object to the local origin point? another point is, that the rotation works just fine that way, when i setup the leg with openSG primitives.
Code: void Leg::setRotation(int n) { TransformPtr resultTrans = linkTransform[n]; Matrix tempJ, tempR, t, r; tempJ.setIdentity(); tempR.setIdentity(); tempTrans.setIdentity(); r.setIdentity(); if(resultTrans!=NullFC) { tempR = resultTrans->getMatrix(); tempJ.setRotate(Quaternion(Vec3f(1,0,0),deg2rad(-45))); tempJ.mult(tempR); tempTrans = linkTransformNodes[n]->getToWorld(); r.inverse(tempTrans); cout << "tx:" << t[0] << " rx:" << r[0] << endl; cout << "tx:" << t[1] << " rx:" << r[1] << endl; cout << "tx:" << t[2] << " rx:" << r[2] << endl; beginEditCP(resultTrans, Transform::MatrixFieldMask); //resultTrans->setMatrix(r); resultTrans->setMatrix(tempJ); endEditCP(resultTrans, Transform::MatrixFieldMask); } else cout << "No rotation was set!" << endl; } best regards, robin p.s. thanks a lot, for the help with the actions, works fine now ------------------------------------------------------------------------- Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys -- and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV _______________________________________________ Opensg-users mailing list Opensg-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/opensg-users