SetGlobalTransform3D problem

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

  • Eric WinemillerEric Winemiller Posts: 84
    edited December 1969

    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.


    We did a lot of changes with transforms in C6. TTreeTransform now has
    two different modes (content figures use the new one).

    To set global transforms, we recommend calling
    SetGlobalTreeTransform2 (it uses the new TGlobalTreeTransform class).

    Arnaud.

    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,

  • edited August 2012

    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

    Post edited by briandaz_3e696c2bd8 on
Sign In or Register to comment.