PDA

View Full Version : simple expression, CollisionU &V , Strange results!!


HJ-panorama
12-15-2010, 12:27 PM
hello

exploring some of the per particle attributes, I started with a fairly old tutorial from Digital Tutores ( advanced shading network ) wherein a simple paintBall gun shoots toward a simple surface .

but for a reason, the following expression which is supposed to return the collision U & V coordination of colliding particles returns very strange results . I don't know why .. here's the expression:

global int $numOfCollisions;
global vector $colUV[];

if (particleShape1.collisionU > 0)
{
$colUV[$numOfCollisions]=
<<particleShape1.collisionU,particleShape1.collisionV,0>>;
$numOfCollisions++;
print ($numOfCollisions + " " );
print ($colUV[$numOfCollisions]+".\n");
}
( the red lines are just for debugging purposes)

the result should be like this :
1 0.323566 .4562236 0
2 0.652356 .5986664 0
....
but this is the result the above expression which is not normal:

1 0 0 0
2 0 0 0
.....

I'm using Maya 2011 64bit sp1 on 64 7 windows.
thank you in advance

Aikiman
12-20-2010, 07:57 PM
Because
"$numOfCollisions++;"
should be at the end of the expression. Currently you are incrementing the array index then printing the current value inside that index which is going to be zero of course :)

CGTalk Moderation
12-20-2010, 07:57 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.