Maxon Developers Maxon Developers
    • Documentation
      • Cinema 4D Python API
      • Cinema 4D C++ API
      • Cineware API
      • ZBrush Python API
      • ZBrush GoZ API
      • Code Examples on Github
    • Forum
    • Downloads
    • Support
      • Support Procedures
      • Registered Developer Program
      • Plugin IDs
      • Contact Us
    • Categories
      • Overview
      • News & Information
      • Cinema 4D SDK Support
      • Cineware SDK Support
      • ZBrush 4D SDK Support
      • Bugs
      • General Talk
    • Recent
    • Tags
    • Users
    • Login

    global pos - mograph COFFEE effector

    Scheduled Pinned Locked Moved SDK Help
    13 Posts 0 Posters 980 Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • H Offline
      Helper
      last edited by

      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

      1 Reply Last reply Reply Quote 0
      • H Offline
        Helper
        last edited by

        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

        1 Reply Last reply Reply Quote 0
        • H Offline
          Helper
          last edited by

          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.

          1 Reply Last reply Reply Quote 0
          • H Offline
            Helper
            last edited by

            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

            1 Reply Last reply Reply Quote 0
            • H Offline
              Helper
              last edited by

              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

              1 Reply Last reply Reply Quote 0
              • H Offline
                Helper
                last edited by

                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

                1 Reply Last reply Reply Quote 0
                • H Offline
                  Helper
                  last edited by

                  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

                  1 Reply Last reply Reply Quote 0
                  • H Offline
                    Helper
                    last edited by

                    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

                    1 Reply Last reply Reply Quote 0
                    • H Offline
                      Helper
                      last edited by

                      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

                      1 Reply Last reply Reply Quote 0
                      • H Offline
                        Helper
                        last edited by

                        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

                        1 Reply Last reply Reply Quote 0
                        • H Offline
                          Helper
                          last edited by

                          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

                          1 Reply Last reply Reply Quote 0
                          • H Offline
                            Helper
                            last edited by

                            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    

                            1 Reply Last reply Reply Quote 0
                            • First post
                              Last post