lab00
07-23-2007, 01:26 PM
Hi all, i'd like to ask a thing about particles:
Is it possible to create a new goal for some particles on Runtime?
I can't figure out this...
The problem is that to create a particle goal it needs to connect the worldMatrix[0] of the transform node that will be the goal, to the goalGeometry[0] of the particleShape.
But if i try to do this connection writing this in a Runtime expression:
if(frame == 100)
connectAttr locator1.worldMatrix[0] particleShape1.goalGeometry[0];
when i play the scene Maya gives this error:
// Error: line 2: Connection not made: 'locator1.worldMatrix[0]' -> 'particleShape1.goalGeometry[0]'. Connections cannot be modified during evaluation. //
// Error: line 2: The attribute 'particleShape1.goalGeometry[0]' cannot be connected to 'locator1.worldMatrix[0]'. //
So connections between nodes cannot be modified during evaluation...
But if i try to connect in the same way to poly spheres:
if(frame == 100)
connectAttr pSphere1.tx pPshere2.tx;
It works !!
So i just create a connection between nodes during evaluation ! ...
(I don't understand why it works between two spheres and not between particleShape and sphere).
In the end, my problem is that, in my scene, at the start of the evaluation, i dont know the number of the objects that i will use as goals, and above all at the start they don't exist yet, but they will be created during evaluation in an unpredictable way, and everytime that one of them will be created it will become a goal for the particles.
So i need to create goals in runtime, because i dont want to create 10000 objects and make all of them goals for the particles at the start... it would be too weighty for the processor...
Is there a way to create a goal for particles in runtime?
Thank you !!
Stefano
Is it possible to create a new goal for some particles on Runtime?
I can't figure out this...
The problem is that to create a particle goal it needs to connect the worldMatrix[0] of the transform node that will be the goal, to the goalGeometry[0] of the particleShape.
But if i try to do this connection writing this in a Runtime expression:
if(frame == 100)
connectAttr locator1.worldMatrix[0] particleShape1.goalGeometry[0];
when i play the scene Maya gives this error:
// Error: line 2: Connection not made: 'locator1.worldMatrix[0]' -> 'particleShape1.goalGeometry[0]'. Connections cannot be modified during evaluation. //
// Error: line 2: The attribute 'particleShape1.goalGeometry[0]' cannot be connected to 'locator1.worldMatrix[0]'. //
So connections between nodes cannot be modified during evaluation...
But if i try to connect in the same way to poly spheres:
if(frame == 100)
connectAttr pSphere1.tx pPshere2.tx;
It works !!
So i just create a connection between nodes during evaluation ! ...
(I don't understand why it works between two spheres and not between particleShape and sphere).
In the end, my problem is that, in my scene, at the start of the evaluation, i dont know the number of the objects that i will use as goals, and above all at the start they don't exist yet, but they will be created during evaluation in an unpredictable way, and everytime that one of them will be created it will become a goal for the particles.
So i need to create goals in runtime, because i dont want to create 10000 objects and make all of them goals for the particles at the start... it would be too weighty for the processor...
Is there a way to create a goal for particles in runtime?
Thank you !!
Stefano
