Dealing with AnimateObject and child objs



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

    On 16/01/2006 at 14:00, xxxxxxxx wrote:

    User Information:
    Cinema 4D Version:   9.5 
    Platform:      
    Language(s) :     C++  ;

    ---------
    Hi,

    I am trying to find the position of an object at any given frame from within a tag.

    So I am doing this

    BaseObject *copy = (BaseObject* )op->GetClone(0,NULL);
    ... calculate new time
    doc->AnimateObject(copy, newTime, ANIMATE_NO_PARTICLES);

    and using the global matrix of the copy object to get the position.

    Now the problem is, op might be a child that has no keyframes, and being animated by its parent.
    The AnimateObject command wont actually tell me where that child object is- because essential the chlid object is not being animated.

    Any solutions for this?

    I have tried Animating the document, and just getting the   objects global position. That worked except, the tag was animating the document and wouldnt let me animate generally in c4d



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

    On 16/01/2006 at 14:38, xxxxxxxx wrote:

    My first reaction would be to say that if op is a child of an animated object and has no keyframes on its own, you should check for this and get the 'parent' animated object (if any). AnimateObject() that object.

    Simply set up a loop:

    BaseObject* parent;  
    for (parent = op; parent && !parent->GetFirstTrack(); parent = parent->GetUp());  
    if (parent) // child or parent is animated  
    

    You may want to check further inside the loop to verify the existence of a Sequence and at least one Key.

    There are two possible outcomes:

    1. You need to apply the appropriate matrix set to the child (considering hierarchical parentage from child to animated object).

    2. The child will have been updated and the updated position will be available through the child.

    (2) is the quicker approach (no matrix multiplying) if it works this way.


Log in to reply