Horde3D http://www.horde3d.org/forums/ |
|
Question/problem about getNodeTransformMatrices http://www.horde3d.org/forums/viewtopic.php?f=2&t=606 |
Page 1 of 1 |
Author: | zbezveze [ 13.01.2009, 19:48 ] |
Post subject: | Question/problem about getNodeTransformMatrices |
Hi. I use the getNodeTransformMatrices function, create a Matrix4f from the pointer it "returns". After that i decompose the matrix to get the euler rotations but they are different from what i get with the getNodeTransform (or the object's .xml file). Guess i'm doing something wrong but i cannot figure what. The code (a little simplified but it sums the problem): const float *local; const float **loc = &local; Horde3D::getNodeTransformMatrices(node,loc,NULL); Matrix4f Matr(local); Vec3f trans,rot,scale; Matr.decompose(trans,rot,scale); Thanx! |
Author: | AcidFaucet [ 13.01.2009, 20:13 ] |
Post subject: | Re: Question/problem about getNodeTransformMatrices |
Quote: getNodeTransformMatrices DLL bool getNodeTransformMatrices( NodeHandle node, const float ** relMat, const float ** absMat ) Returns the transformation matrices of a node. This function stores a pointer to the relative and absolute transformation matrices of the specified node in the specified pointer varaibles. Parameters node handle to the scene node to be accessed relMat pointer to a variable where the address of the relative transformation matrix will be stored (can be NULL if matrix is not required) absMat pointer to a variable where the address of the absolute transformation matrix will be stored (can be NULL if matrix is not required) Returns true in case of success otherwise false or, getNodeTransform(NODE, RELATIVE MATRIX, ABSOLUTE MATRIX); You're operating on the relative transform matrix and not the absolute matrix. If that's what you want then use setNodeTransformMatrix. |
Author: | zbezveze [ 13.01.2009, 20:27 ] |
Post subject: | Re: Question/problem about getNodeTransformMatrices |
getNodeTransform does't work with matrices, it stores the data in variables provided in the argument (according to the API 1.0.0 Beta 2). And the transformations are in local space. So i my case i just try to extract the rotation angles (in local space) from the matrix given by getNodeTransformMatrices function. |
Author: | Volker [ 13.01.2009, 21:16 ] |
Post subject: | Re: Question/problem about getNodeTransformMatrices |
You know that decompose is giving you the angles in radians while getNodeTransform and the XML file attributes are in degrees? @AcidFaucet: Quote: You're operating on the relative transform matrix and not the absolute matrix. If that's what you want then use setNodeTransformMatrix. Not sure what you mean with that, setNodeTransformMatrix is also setting the relative matrix. |
Author: | zbezveze [ 13.01.2009, 21:59 ] |
Post subject: | Re: Question/problem about getNodeTransformMatrices |
Volker wrote: You know that decompose is giving you the angles in radians while getNodeTransform and the XML file attributes are in degrees? Damn... ![]() Everything in Horde3D is in degrees so i asumed that the utMath also follows the same rule because comes packed with it. Obviously wrong. Thanx, you saved me a lot of trouble |
Author: | Volker [ 13.01.2009, 22:05 ] |
Post subject: | Re: Question/problem about getNodeTransformMatrices |
You're welcome,... but keep in mind that handling transformations with euler angles may cause problems with singularities. Don't know what you want to do with the parameters, but you may consider using the transformation matrices itself. |
Author: | zbezveze [ 13.01.2009, 22:45 ] |
Post subject: | Re: Question/problem about getNodeTransformMatrices |
Yes, i know. I just need degrees in a short step (a conversion) so it should not cause problems... thanx for the warning anyway |
Author: | AcidFaucet [ 13.01.2009, 23:48 ] |
Post subject: | Re: Question/problem about getNodeTransformMatrices |
Quote: AcidFaucet: Quote: You're operating on the relative transform matrix and not the absolute matrix. If that's what you want then use setNodeTransformMatrix. Not sure what you mean with that, setNodeTransformMatrix is also setting the relative matrix. I'm confusing my APIs. |
Page 1 of 1 | All times are UTC + 1 hour |
Powered by phpBB® Forum Software © phpBB Group https://www.phpbb.com/ |