Horde3D http://horde3d.org/forums/ |
|
Applying transformations to joints http://horde3d.org/forums/viewtopic.php?f=2&t=551 |
Page 1 of 1 |
Author: | zbezveze [ 03.11.2008, 08:08 ] |
Post subject: | Applying transformations to joints |
Hi! I'm new, so please help. I'm trying to transform joints on the man model from the Chicago sample. I have loaded it on it's own without the crowd and the walk animation. The code: _test = Horde3D::getNodeChild(_man,14); Horde3D::setNodeTransform( _man, 0, 0, 0, -90, 0, 0, 1, 1, 1); According to man.scene.xml that should be the head. After some debugging i discovered that _test is always 0 after execution no matter which node index i try. Does anybody know why is that? At first i thought that joints are not considered nodes but after reading the API i discovered it is not the case. So, my question is: How do i acces joint nodes and transform them? Thank you |
Author: | Volker [ 03.11.2008, 09:21 ] |
Post subject: | Re: Applying transformations to joints |
As mentioned in the getNodeChild docs "This function looks for the n-th (index) child node of a specified node and returns its handle. If the child doesn’t exist, the function returns 0". So if _test is always null, the _man Node does not have 15 childs. Indead it has only two childs. One root joint called "Hips" and one mesh node called "body". You can investigate that yourself if you look into the "man.scene.xml" file. To access a specific joint you might better use findNodes and getNodeFindResult first, then store the returned scene graph index and use that index for setNodeTransform. I guess your use of _man when calling setNodeTransform while trying to store the joint index in the variable _test was only a typo |
Author: | zbezveze [ 03.11.2008, 17:15 ] |
Post subject: | Re: Applying transformations to joints |
Volker wrote: As mentioned in the getNodeChild docs "This function looks for the n-th (index) child node of a specified node and returns its handle. If the child doesn’t exist, the function returns 0". So if _test is always null, the _man Node does not have 15 childs. Indead it has only two childs. One root joint called "Hips" and one mesh node called "body". You can investigate that yourself if you look into the "man.scene.xml" file. To access a specific joint you might better use findNodes and getNodeFindResult first, then store the returned scene graph index and use that index for setNodeTransform. I guess your use of _man when calling setNodeTransform while trying to store the joint index in the variable _test was only a typo Yes, that _man /_ test whas a typo. I thought that the children of the man's children are still the man's children (whoaa!). I mean, man has a child node called "Hips" (jointIndex=1) and this node has it's own child called "RightUpLeg" (jointIndex=2). So i thought this leg is still the man's child. So you say the man cannot be a granpa? I tried the following: _test = Horde3D::getNodeFindResult (Horde3D::findNodes (_man, "Head", SceneNodeTypes::Undefined)); Then after re-readind for the 4th time: _test = Horde3D::getNodeFindResult (Horde3D::findNodes (_man, "Head", SceneNodeTypes::Undefined) - 1 ); and it finally worked. Thanks, you helped me a lot! |
Author: | Volker [ 04.11.2008, 08:17 ] |
Post subject: | Re: Applying transformations to joints |
You're welcome,.. the findNodes/getNodeFindResult method is allocating a zero index based internal array for the search results. That's why you have to access it with zero. Maybe it's getting clearer if you write it like that: Code: int numResults = Horde3D::findNodes (_man, "Head", SceneNodeTypes::Undefined);
if( numResults > 0 ) _test = Horde3D::getNodeFindResult ( 0 ); |
Page 1 of 1 | All times are UTC + 1 hour |
Powered by phpBB® Forum Software © phpBB Group https://www.phpbb.com/ |