SetTime() on Document



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 04/12/2004 at 14:55, xxxxxxxx wrote:

    User Information:
    Cinema 4D Version:   8.100 
    Platform:      Mac OSX  ; 
    Language(s) :   C.O.F.F.E.E  ;

    ---------
    Hey all,

    In a plugin I'm working on I'm setting the time of the document (so say if I find a keyframe, and jump to it's time by calling doc->SetTime(key->GetTime())) and then trying to get an object's position and rotational values (by calling GetMgn()) at that point in time, yet when I do so I always get the values of the object at the first frame. Is there some step I'm missing?

    Thanks!
    Derek Arndt



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 04/12/2004 at 17:41, xxxxxxxx wrote:

    Matrices only contain initial transformation information. In order to get changes over time, you need to get the timecode (as you're doing) then relevant keyframes at that timecode, then tracks (Position, Scale, Rotation tracks, for instance). If C4D changed the matrix over time while scrubbing or such, the error would grow uncontrollably. So, the tracks contain changes of these parameters over time instead.



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 04/12/2004 at 18:23, xxxxxxxx wrote:

    Alright, so the matrices are useless to me now. Problem is I have no idea how to convert HPB values in a 4x4 matrix so I can use that matrix. Shouldn't be too hard, right?

    Also, and without having the ability to use the object's world matrix, how can I get the object's world-space position and rotation values? I assume GetPosition() only returns the position in object space...



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 04/12/2004 at 20:16, xxxxxxxx wrote:

    For getting/setting rotation, position, scale values with respect to a matrix, you should check out "Using Matrices" under the Tutorials section here. The second question is answered in the tutorial as well.

    Yes, for some odd reason, both COFFEE and the C++ SDK have Get/Set functions for Local space but none for Global space (remember that there is only Global -world- space and Local -parent- space. If the object has no parent, then the Global and Local spaces are identical).

    Robert



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 04/12/2004 at 23:47, xxxxxxxx wrote:

    So after I change the time of the document and want to get the pos/rot values of an object I'd do:

      
                   var line;  
                   var newGlobalPos = op->GetMg()->GetMulV(op->GetPosition());  
                   var tempMatrix;  
                   tempMatrix->SetRotHPB(op->GetRotation());  
                   var newGlobalRot = op->GetMg()->GetMulM(temp);  
                     
                   SetGlobalPosition(op, newGlobalPos);  
                   SetGlobalRotation(op, newGlobalRot);  
                     
                   var ObjectMat = op->GetMg();  
                   var ObjectPos = ObjectMat->GetV0();  
                   var rot1 = ObjectMat->GetV1();  
                   var rot2 = ObjectMat->GetV2();  
                   var rot3 = ObjectMat->GetV3();  
      
                   etc...  
    



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 05/12/2004 at 03:53, xxxxxxxx wrote:

    Hi,

    also here I would suggest to call either AnimateObject() or AnimateDocument() to notify Cinema 4D of the animation/timeline changes.

    But am not sure about it, so no guarantee :)

    Hope it helps


Log in to reply