Horde3D http://horde3d.org/forums/ |
|
modify the position and orientation of a loaded resource. http://horde3d.org/forums/viewtopic.php?f=2&t=1659 |
Page 1 of 1 |
Author: | kinectguy [ 28.03.2012, 19:01 ] |
Post subject: | modify the position and orientation of a loaded resource. |
Hi all, I'm currently trying to modify each joint of a custom rig loaded as a resource in the Horde3D engine. The idea would be to browse each joint node, retrieves it position & orientation and modify it. But I also have a constraint, I need to check the joint name before modify it. Rough Example: Code: //... H3DNode rigNode= h3dAddNodes( H3DRootNode, MyRigResource ); std::string MyCustomJointName="..." //retrieves all joints int countNodes=h3dFindNodes( rigNode, "", H3DNodeTypes::Joint); for(int index=0 ; index<countNodes ; ++index) { H3DNode joint=h3dGetNodeFindResult( index ); // find a way to compare the horde3D joint name with my custom joints data if ( h3dGetNodeParamStr(joint,MyCustomJointName) ) { float x = h3dGetNodeParamF(joint,H3DGeoRes::GeoVertPosStream,0); float y = h3dGetNodeParamF(joint,H3DGeoRes::GeoVertPosStream,1); float z = h3dGetNodeParamF(joint,H3DGeoRes::GeoVertPosStream,2); h3dSetNodeParamF(joint,H3DGeoRes::GeoVertPosStream,x*2.0); h3dSetNodeParamF(joint,H3DGeoRes::GeoVertPosStream,y*2.5); h3dSetNodeParamF(joint,H3DGeoRes::GeoVertPosStream,z*1.5); } } Actually my main problem is that I don't know how to retrieve the position & orientation data from a joint node. I someone has an idea, it will really be useful. Thanks |
Author: | Volker [ 28.03.2012, 21:48 ] |
Post subject: | Re: modify the position and orientation of a loaded resource |
You can't change the loaded resource data without manipulating the whole resource data and reload it into horde. Do you really want to change the resource data or it's loaded node representation. Take note that their's a difference between resources and scene nodes. |
Author: | kinectguy [ 28.03.2012, 22:03 ] |
Post subject: | Re: modify the position and orientation of a loaded resource |
Hi Volker, Well, I don't really have the choice, the idea is to be able to use the kinect in real time and change the position of the loaded rig according to the 3D positions given by the kinect 3D camera. Therefore, I really need to modify the rig, at each frame, in real time. If you have an idea on how I can achieve this, please do so Thanks. |
Author: | Volker [ 29.03.2012, 07:06 ] |
Post subject: | Re: modify the position and orientation of a loaded resource |
For such a use case you only need a model with joints that could be mapped to the kinect's skeleton representation. You have to load this model resource with all it's meshes and joints and add it to the scene graph. You can then manipulate the joints' transformations by using e.g. h3dSetNodeTransform. Take note that you transform the joint nodes in the scene graph and not the resourcedata itself. |
Page 1 of 1 | All times are UTC + 1 hour |
Powered by phpBB® Forum Software © phpBB Group https://www.phpbb.com/ |