aim locator to particle on softbody


i have a problem with snap locator to the particle on softbody .
i have 1 tutorial that he said if you want to snap your locator to particles youo must write this expression :

float $position1[] = getparticleAttr -at worldposition[1];

locator1.translateX = $position1[0];
locator1.translateY = $position1[1];
locator1.translateZ = $position1[2];

float $position7[] = getparticleAttr -at worldposition[7];

locator2.translateX = $position7[0];
locator2.translateY = $position7[1];
locator2.translateZ = $position7[2];

float $position19[] = getparticleAttr -at worldposition[19];

locator3.translateX = $position19[0];
locator3.translateY = $position19[1];
locator3.translateZ = $position19[2];

but i cant use this expression . i don no why .

dose anybody know that what should i do ? for snap these locator to the particles for aim 3 nude camera ?

please help me .
im waiting for your answer


All you have to do is connect with the connection Editor

The particle World Centroid to -> locator Translate and rotate.


[size=2]connectAttr -f particleShape2.worldCentroid locator2.translate;

connectAttr -f particleShape2.worldCentroid locator2.rotate;



yes man but now i have a lot of particles on the soft body and i cant use the connection editor for do that .if i had 1 particle yes i could use connection editor but now i cant .
thx man for your comment


Now that it seems to work :slight_smile: … Per our messenger conversation. Post the end result so I can see what it is you’re doing :thumbsup:



If all you need is a a locator attach to the surface why don’t you just use the " rivet.mel "

It constraints locator to Polygon or NURBS surfaces. Select two edges on polygon surface or one point on NURBS surface and click [b]rivet[/b] icon.
Script creates locator. After that you can parent or constrain any object to it. Or constrain objects to locator from other hierarchy.
Note: Script doesn’t create expressions. Calculation is fast and interactiv


yes man
the best choice is rivet.mel only .
i did it very easily by the rivet .
thx all


Didn’t you message me on messenger, and I write you a script to do this for you, only on particles and not vertices? I’d hope you reverted over to rivet.mel for some reason. I put work aside to help and write that script for you :rolleyes: … (albeit it was a simple one)

// Written by Seth Hall
// Summer 2006
// Usage:
//		Select individual particle points of a particle object, execute the script.
//		Quick and dirty, could be better, was a freebie. Use at your own risk :)
//		Don't forget to phone your mother.

global proc partyLoc() {
	string $sel[] = `ls -sl -fl`;
	string $name;
	string $group;
	string $buffer[];
	string $locator[];
	int $create = 0;

	if (size($sel) < 1) {
		warning ("You need to select an individual particle point.");
	} else {

		$group = `group -em -n ("partyLoc_#")`;

		int $i;
		for ($i = 0; $i < size($sel); $i++) {
			tokenize $sel[$i] "." $buffer;

			if (`nodeType $sel[$i]` == "particle") {
				$locator = `spaceLocator -n ("pl_" + $buffer[0] + "_" + $buffer[1]) -p 0 0 0`;

				expression -s ("float $position[] = `getParticleAttr -at worldPosition " + $sel[$i] + "`;

" + $locator[0] + ".translateX = $position[0];
" + $locator[0] + ".translateY = $position[1];
" + $locator[0] + ".translateZ = $position[2];") -o $locator[0] -n ("pl" + $buffer[0] + "_EXP_" + $buffer[1]) -ae 1 -uc all ;

				parent $locator[0] $group;

				clear $locator;
				clear $buffer;


		if ($create < 1) {
			delete $group;

		print ("Created " + $create + " locator(s).

	clear $sel;




yes man i know . but sorry i wanted you tell all about your work . it’s your work .
thats it man . why you angry ?

many thx for your kindly help


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.