global pos - mograph COFFEE effector



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

    On 30/12/2009 at 03:45, xxxxxxxx wrote:

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

    ---------
    Hi,

    does anyone know if it's possible to determine / set the global position of a mograph clone using the new 11.5 COFFEE effector?

    I can get and set the local position easily enough:

      
            var md = GeGetMoData(op);   
            var marr = md->GetArray(MODATA_MATRIX);   
      
            println(marr[0]->GetV0());   
    

    But any attempt to retrieve the global position throws an error:

      
            println(marr[0]->GetMg()->GetV0());   
    

    I'd be grateful for any pointers.

    Thanks

    Jon



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

    On 30/12/2009 at 06:23, xxxxxxxx wrote:

    First switch the COFFEE effector to "Full Control" mode.

    Then get the global position by multiplying the clone's local postion with the generator's (cloner, fracture object etc) global matrix.

    Here is a simple example (doing nothing except printing the global position)

      
    main(doc,op)  
    {  
      var md = GeGetMoData(op);  
      if (!md) return false;  
      var cnt = md->GetCount();  
      var marr = md->GetArray(MODATA_MATRIX);  
      var fall = md->GetFalloffs();  
      
      var obj = md->GetGenerator();  
      if (!obj) return false;  
      
      var mg = obj->GetMg();  
      
      var i = 0;  
      for (i = cnt - 1; i >= 0; --i)  
      {  
          var pos = marr[i]->GetV0();  
          pos = mg->GetMulP(pos); //pos is the global position  
      
          println(pos);  
      }  
      
      md->SetArray(MODATA_MATRIX, marr, true);  
      return true;  
    }  
    

    cheers,
    Matthias



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

    On 30/12/2009 at 07:15, xxxxxxxx wrote:

    Hey thanks Matthias!

    So... to then set the global pos back into the matrix, I'd go:

      
    mg->Invert();   
    var backToLocal = mg->GetMulP(pos);   
    marr[i]->SetV0(backToLocal);   
      
    md->SetArray(MODATA_MATRIX, marr, true);   
      
    

    This is very enlightening and useful but hasn't solved my real query. I was assuming that in finding out the global position, I would get the clone's position during mograph dynamics. But while huge positional/rotational changes are occurring with dynamics, the positional read out of the clones remains the same. So my next question...

    Is it possible to determine the position of a clone as affected by mograph dynamics?

    Thanks again

    Jon



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

    On 06/01/2010 at 05:47, xxxxxxxx wrote:

    I'm just asking myself the same thing. Must be something with the evaluation sequence of the effector, because the Xpresso node calculates those values just fine.
    Very helpful thread BTW.



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

    On 06/01/2010 at 05:56, xxxxxxxx wrote:

    Hi Sparkle,

    I hit a brick wall here I'm afraid, and have since been distracted away from this. Can anyone out there help please? Even if it's a definitive 'it's not actually possible' (which would be a major disappointment)

    Cheers
    Jon



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

    On 06/01/2010 at 08:36, xxxxxxxx wrote:

    I'd love to see/know to.
    Basically (for me) if it is now possible to get the same data
    as from the MoGraph xpresso Data Node.

    Cheers
    Lennart



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

    On 06/01/2010 at 20:16, xxxxxxxx wrote:

    I haven't tried it, but I think you'd be best to cache the cloner and make sure the object with the coffee tag is below it in the OM. Also switch the expression priority on the coffee tag to Dynamics 499.
    That should make sure it calculates after the clones are in position.

    Cheers,
    Brian



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

    On 07/01/2010 at 02:39, xxxxxxxx wrote:

    Unfortunatly MoDynamics can not be accessed within the COFFEE effector. Caching will not help either because an active cache will disable effectors.

    cheers,
    Matthias



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

    On 07/01/2010 at 03:12, xxxxxxxx wrote:

    Oh well.

    Thanks for clearing it up Matthias.

    Jon



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

    On 07/01/2010 at 07:06, xxxxxxxx wrote:

    Ah.. another baffling limitation with Coffee..seems strange that you can do this fine with xpresso.
    Thanks for the clarification anyway.

    I guess it's time to start learning Python:frowning2:

    Cheers,
    Brian



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

    On 07/01/2010 at 07:39, xxxxxxxx wrote:

    This has nothing to do with being COFFEE. It's just a limitation of the COFFEE effector itself.

    cheers,
    Matthias



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

    On 07/01/2010 at 13:41, xxxxxxxx wrote:

    I understand, sorry I'm just a little frustrated as recently I seem to have a knack for trying to do things with Coffee that it can't do and each workaround I try has ended up at a dead end. This has left me with the overall impression that Coffee has not been updated at the same rate as the rest of the program.

    Cheers,
    Brian



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

    On 07/01/2010 at 15:07, xxxxxxxx wrote:

    @Horganovski: I'm feelin ya! With the previous project I did I was so disappointed every time I found out that some things are just not possible in coffee.
    I guess in the end I just have myself to blame for being too lazy for making the leap to C++ but I'd still consider myself rather a designer than a programmer.

    @Matthias Bober: Despite my b**ching, thanks again for you helping us with our tedious problems all the time    


Log in to reply