Hi Robin, Robin Steinke wrote: > Hi everybody, > > i want to animate a leg. this leg consists of links and leg parts. for > the animation i use inverse kinematics. now i have a *.bin file, which > contains the complete leg in hierarchical order. to animate the leg, i > need access to the transform nodes. and basically this is my question, > how can i do that? my idea was, to store the transform nodes into a > vector, and fill this vector by traversal the graph. but how?
this sounds like the right idea. > i only > managed to receive the NodePtr by node->getChild(i) but not the > TransformPtr. any suggestions on that? > and maybe i get the whole concept wrong... OpenSG makes a distinction between Node and NodeCore, where the former only contains the structure of the graph (parent/child relation) and the latter contains the functionality of the node (for some introductory documentation, check out the tuorial: http://www.opensg.org/doc-1.6.0/TutorialIntroduction.html) Assuming your graph looks like this (NodeCore types in brackets): Node (Group) "root" Node (Transform) "hip joint" Node (Geometry) "upper leg" Node (Transform) "knee joint" Node (Geometry) "lower leg" and you have a NodePtr sceneRoot to the root, to get the "hip joint" transformation, use this (I did not compile this code, so please take it with a grain of salt): NodePtr hipNode = sceneRoot.getChild(0); NodeCorePtr hipCore = hipNode.getCore(); TransformPtr hipTransform = TransformPtr::dcast(hipCore); if(hipTransform != NullFC) { beginEditCP(hipTransform, MatrixFieldMask); hipTransform->getMatrix().setIdentity(); endEditCP(hipTransform, MatrixFieldMask); } In OSGAction.h there are functions called traverse, that will go through the given graph and perform user supplied operations on each node. You can use these to find all transforms and put them in a vector. To use these functions you have to use OpenSG's functors which have somewhat intimidating creation functions, so please ask again if those give you trouble. Hope it helps, Carsten ------------------------------------------------------------------------- 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 [email protected] https://lists.sourceforge.net/lists/listinfo/opensg-users
