PDA

View Full Version : "event -proc" question


nessus
02-19-2006, 07:15 AM
i am trying to use this command with -proc flag to triger a procedure.
here is the simple code example:

global proc test(string obj, int id, string objHit)
{ scale -r 5 5 5 pCube2;
}
event -proc test(particle1, 0, pCube1) particle1;

what this code is supposing to do is that when particle ID "0" of "particle1" collides with "pCube1", global proc test is called, and it will scale pCube2 to 5 5 5 in space.


this is the error returned:
"// Error: Invalid use of Maya object "particle1". //"

following is the description from maya doc:

-proc (-pr)
Specify a MEL proc to be called each time the event occurs. This must be a global proc with arguments as follows: global proc procName( string obj, int id, string objHit ); Arguments passed in are the name of the particle object, the id of the particle which collided, and the name of the object collided with. You can use particle -id -q to get values of the particle's attributes.

maya example:
event -proc myProc myCloud
Call the MEL proc "myProc(name, id, name) each time a particle
of myCloud collides with anything.

A_New_Hope
02-19-2006, 08:33 AM
this will code will scale pCube2 when particle1 id 0 collide with pCube1,
note that $objHit is the shape of pCube1 and that there is a space in the beginning " pCubeShape1"

global proc test(string $obj, int $id, string $objHit)
{
if ( $objHit == " pCubeShape1" && $id == 0 )
{
scale -r 5 5 5 pCube2;
}
}

event -proc test particle1;

nessus
02-19-2006, 11:04 AM
thank you very much "a_new_hope", yes u are indeed!!!

careless me, just copied the code from the doc without thinking putting the "$" in front of the variables, how stupid i was!!!

CGTalk Moderation
02-19-2006, 11:04 AM
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.