Mograph Speed to Color

  • On 25/03/2014 at 15:34, xxxxxxxx wrote:

    I'm very new to Python but would happy to make this effect i have tried with MODATA_LASTMAT read the previous postion to get the speed.
    But get at MODATA_LASTMAT only (0,0,0) as output.
    Any help?
    (Googel Translator)

    import c4d
    from c4d.modules import mograph as mo

    #Welcome to the world of Python
    def main() :
      md = mo.GeGetMoData(op)
      if md==None: return False
      cnt = md.GetCount()
      marr = md.GetArray(c4d.MODATA_MATRIX)
      marr_p = md.GetArray(c4d.MODATA_LASTMAT)
      col = md.GetArray(c4d.MODATA_COLOR)
      for i in xrange(0, cnt) :
          a = marr
          b = marr_p
          print b
      md.SetArray(c4d.MODATA_MATRIX, marr, True)
      md.SetArray(c4d.MODATA_COLOR, col, True)
      return True

  • On 25/03/2014 at 17:36, xxxxxxxx wrote:

    Turtle, I'm pretty sure you already contacted me earlier today, and I already gave you all the info you need.

    MODATA_LASTMAT doesn't give you the previous matrix, you need to store the previous matrix yourself. Then you can calculate the velocity.

    speed = (marr[i].off - prevmarr[i].off).GetLength()
    You can then map that speed to whatever mograph property you want.

    I got a video coming soon that elaborates more on the concept and a couple files that come with it.

    For now, you can check out this project file from krotmonster, which uses the same concept :

    Not sure what else you expect ?
    This is all basic programming and all the info is already out there.
    Please do at least a little effort first, and do some research ! That's the only way to learn.

    A few google queries will quickly point you to a few related threads on a number of boards.
    You'll also come across Lennart from tcastudios as well. He's the guy who initially inspired me to these setups.

    Have fun exploring !!

Log in to reply