THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 27/10/2007 at 07:26, xxxxxxxx wrote:
Cinema 4D Version: R10
Platform: Windows ;
Language(s) : C++ ;
Joints save their fixationmatrix relative to the absolute world coordinates, however I need the fixationmatrix relative to its parent coordinatesystem in the hierarchy.
\> LONG k = tag- >FindJoint(obj, 0);
\> JointRestState fix_state = tag->GetJointRestState(k);
fix_state only has m_Mg and its inversematrix m_Mi.
Internally m_Ml has to be saved somewhere, or else I couldnt move an object without resetting the pose in the weighttag (which i dont have to do)
So, how can I access the local fixationmatrix of a joint?
Tnx for any help in advance
On 27/10/2007 at 16:17, xxxxxxxx wrote:
You can get an object's local matrix by multiplying its global matrix by its parent object's inverse global matrix:
jointMl = !parentMg * jointMg;
On 29/10/2007 at 02:49, xxxxxxxx wrote:
Tnx Dan, but I know that.
I think i didnt describe my problem well enough.
What I need is the local transformationmatrix of the from the "original" mesh to the joint fixation point.
Here's the problem:
Assuming you have a mesh at (0,0,0) with a rotation of (0,0,0) and you have a joint at the same coordinates with the same rotation.
Now you bind the joint to the mesh.
Binding the joint to the mesh sets an absolute fixation position for the joint that you can access as described in my first post.
As long as you dont move the mesh everything is fine and you can get ml with your formula.
But if you go ahead and move the mesh to another position you have a problem.
Using ml of the joint from the new position is not an option either since you could move the joint.
However, the weighttag has a reset pose button which puts mesh and joint back to the original fixation point.
So those matrices I need are stored somewhere, i just dont know where or how to access them.
any help is greatly appreciated.
On 29/10/2007 at 04:04, xxxxxxxx wrote:
Unfortunately this has been missed from the api. The matrices are stored as global for the joints but the geometry global is also stored. This is what you need to get but the api has no function to do it. The only way to get this I can think of is with a nasty hack. The matrix is stored in the tags nodedata, so you could do this:
> UCHAR *wdata=(UCHAR* )weighttag- >GetNodeData();
> Matrix mg=*(Matrix* )(wdata+12);
This is not good practice but at the moment it is the only way I can think of. If you do ever use anything nasty like this always put in a c4d version check since any future version may not work with this. You would also need to check this works on whatever versions of CINEMA you plan to use it with and platforms.
I'll make sure the function is now added to the api for the future to get this correctly.
On 29/10/2007 at 04:21, xxxxxxxx wrote:
It works just fine, thank you so much for the quick help.
On 29/10/2007 at 06:48, xxxxxxxx wrote:
AH! Sorry about that. I reckon I didn't understand. :o(