SetGlobalTransform3D problem
briandaz_3e696c2bd8
Posts: 0
Writing a plugin behavior, (Apply() method of a modifier) I'm having trouble with setting the transform:
TTransform3D tr = tree->GetGlobalTransform3D(kCurrentFrame);
tr.fTranslation.z = newZ;
tree->SetGlobalTransform3D(tr);
This code should only move the object up or down, right? But when I use it on an object whose hotpoint is not at object center, then the object moves a bit in X and Y every time I adjust the camera's position. (Which has nothing to do with the object that has the modifier, but does force the modifier to recalculate.)
I found an old topic by DCG Eric that seems to mention a similar problem, but there was no reply:
old forum topic
What am I doing wrong??
Comments
Hi Brian,
Sadly I do not remember the context of the question, but I dug around the Carrara SDK yahoo group and found Arnaud's reply.
As I look in my code however, I do not appear to be following his advice. I do not use SetGlobalTreeTransform2 anywhere and I seem to still be using SetGlobalTransform3D quite a bit.
Good luck,
So, in other words, we're supposed to use the function that says "NOTE: this function should be avoided as much as possible as it cannot work in some cases" in the SDK?
lol