I'm working on some code that calulates the vectorMagnitude of an
object and then assigns that magnitude to the particles mass. the only
problem i'm having is that it doesn't seem to want to assign the mass
to the particle. The code will execute fine but when you run the
simulation it'll give an error saying the particles have no mass and
will not run properly. To get round this i had to have a static mass
that i assigned to the particles using a dynamic expression. This is
the bit of code i'm having a problem with:-

        # Need to add a vector component.
        floatVector = om.MFloatVector(floatX, floatY, floatZ)

        # Get total length of vector
        vectorMag = sqrt((floatVector[0]*floatVector[0])+(floatVector[1]
*floatVector[1])+(floatVector[2]*floatVector[2]))

        # Emit particle to object postion with attributes. Still doesn't know
why "at= 'mass'" doesn't work.
        mc.emit (object = 'Wall_Test', position = (floatParticlePosition[0],
floatParticlePosition[1], floatParticlePosition[2]), at= 'mass',
floatValue= vectorMag)

        # Work around
        mc.dynExpression ('Wall_Test', s= " mass = 0.49; ", c=True)

I was wondering if any one has any ideas as to why the emit line of
code doesn't work? Any help would be appreciated.
--~--~---------~--~----~------------~-------~--~----~
http://groups.google.com/group/python_inside_maya
-~----------~----~----~----~------~----~------~--~---

Reply via email to