Feedback

What's your question?

By: [ Editor ] Asked from United States of America

Getting the distance from two locators

Hello Everyone,

This question is related to the "ripple particles" that I have already posted. Thanks for helping out Julian.

I think I want to take the whole ripple of particles thing into an actual tool, I think it would be nice to have something like this available with only a few clicks that would allow the user to even have a locator that would control the position of the ripples. I wanted to start by creating two locators, getting their positions and creating a grid of particles.

Here is what I have so for, the problem right now is that I am not sure if it is legal for me to pass the two locator's positions as the particle -lowerLeft -upperRight values. Here is what I have. The error that I get says // Error: Error while parsing arguments. I think it is because of the q- flags but I am not sure. Thanks again for your help.

//Create two variables for the two main locators and move them in the x and z.
string $myFstLoc[] = `spaceLocator -position 0 0 0`;
move -relative 12 0 12 $myFstLoc[0]; 

string $mySecLoc[] = `spaceLocator -position 0 0 0`;
move -relative -12 0 -12 $mySecLoc[0] ;

//Select the first locator, now both locators are selected.
select -add $myFstLoc[0];

//List the two selected locators.
//Query their positions and create a grid of particles.
string $mySeleLocators[] = `ls -selection`;

vector $myFirstLocPos = `xform -q  -translation $myFstLoc[0]` ;
print ("My first locator's position is:" + $myFirstLocPos + "\n");

vector $mySeconLocPos = `xform -q  -translation $mySecLoc[0] `;
print ("My second locator's position is:" + $mySeconLocPos + "\n");

//Create a particle grid based on the position of locator1 and 2.
particle -ll $myFirstLocPos -ur $mySecLoc -grs 0.5 -c 1 ;

Add comment viewed 225 times Latest activity 11 months ago

NN comments
martin_61
-

Hello Julian, I might be seeing something that you done on this page. On the right hand side of the buttons “edit” rollback" “delete” “flag” there is a picture of you that says “edited and how many hours ago you edited however I do not see anything that you edited here. Perhaps it means something else.

julian
-
– it was a tiny edit to the text – no worries ;) BTW – nice to see the code formatting attempts to apply syntax highlighting to the mel eh?

martin_61
-

Ok cool, yes is like writing a poem, lol. I just need more practice in MEL AND PYTHON.

or Cancel

1 answer