PDA

View Full Version : lock particle position


H3ro
05-01-2006, 02:20 AM
Hi , I am trying to lock the particles position, so it can only move up. First i thought this would be really easy, but if you make something collide with the particles, it get really hard.

This is the idea i have to solve this, to base the particles X and Z position to the position of a vertex. (the particles will be emited from the plane)


Its a runtime expression

code:
if (particleShape1.id = 1)
vector $vertPos = `xform -ws -q -t pPlane1.vtx[1]`;

vector $pos = particleShape1.position;
particleShape1.position = <<$vertPos.x,$pos.y,$vertPos.z>>;


I know i need to change it into a loop, but first i need to solve a problem,
"vector $vertPos = `xform -ws -q -t pPlane1.vtx[1]`;" returns an error

Any ideas on how to remove this error, or to solve this problem in an other way?

Sanctuary
05-01-2006, 02:54 AM
i`m not sure i understand what you are trying to achieve :

- make particles to move only in Y+ being emited from a plane`s vertex position and stop it by colliding it with and object ? :D

rokandic
05-01-2006, 10:37 AM
code:
if (particleShape1.id = 1)
vector $vertPos = `xform -ws -q -t pPlane1.vtx[1]`;
vector $pos = particleShape1.position;
particleShape1.position = <<$vertPos.x,$pos.y,$vertPos.z>>;

There's one problem:
if (particleShape1.id = 1)

should be
if (particleShape1.id == 1)

Also, vector $vertPos is only initialized for particle id 1 but gets also used for particles with different id's. I suggest that you either initialized $vertPos before the if statement or set that position inside the if statement together with initialization of $vertPos.

Hope this helps,

-rok

H3ro
05-01-2006, 10:44 PM
what i want is to make:
particle1 = vertex1
particle2 = vertex2

It will be almost the same as goal, but I only want the X and Z value to be equal, so Y is free to move.

If that made any senese at all..

H3ro
05-03-2006, 03:26 PM
Solved the problem:

//variables
int $noPart = 121;


//the loop
int $i = 0;
while ($noPart > $i)
{
vector $pos = particleShape1.position;
vector $posVert = `xform -q -ws -t pPlane1.vtx[$i]`;

if (particleShape1.id == ($i))
{
particleShape1.position = <<$posVert.x,$pos.y,$posVert.z>>;
}

$i++;
}

CGTalk Moderation
05-03-2006, 03:26 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.