JasonA
12-27-2004, 02:53 PM
can someone help me with writing an expression to control the life of a particle? I know what I need mathematically, but I don't know how call the attributes in the expression editor to do the calculation.
What I have is a directional particle emitter aimed to a locator and I want the particles to die when they reach the locator. Since I haven't firmly decided what velocity I want to use, I want to make an expression that calucates it for me automatically for me. I will use some basic vecotrs to accomplish this.
Ok the component names are:
emitter1
locator1
particle1
the math I need to do goes like this:
lifespan (in seconds) = (magnitude of position vector of locator from emitter) / Particle Velocity.
To determine the magnitude of the position vector of the locator, we need to determine its distance from the emitter and take the square root of the sum of the squares of those components. Thats basically x,y, and z of the locator(2) minus x,y, and z of the emitter(1). Then take the square root ofthe sum of the squares, in other words
distance = sqrt[ (X2-X1)^2+(Y2-Y1)^2+(Z2-Z1)^2 ]
Then multiply this by the velocity attribute of the particle, and I should have lifespan in seconds.
Lifespan = distance / velocity
Can anyone help me write this expression given the components names I mentioned? I have no clue how to write the syntax properly.
:sad:
What I have is a directional particle emitter aimed to a locator and I want the particles to die when they reach the locator. Since I haven't firmly decided what velocity I want to use, I want to make an expression that calucates it for me automatically for me. I will use some basic vecotrs to accomplish this.
Ok the component names are:
emitter1
locator1
particle1
the math I need to do goes like this:
lifespan (in seconds) = (magnitude of position vector of locator from emitter) / Particle Velocity.
To determine the magnitude of the position vector of the locator, we need to determine its distance from the emitter and take the square root of the sum of the squares of those components. Thats basically x,y, and z of the locator(2) minus x,y, and z of the emitter(1). Then take the square root ofthe sum of the squares, in other words
distance = sqrt[ (X2-X1)^2+(Y2-Y1)^2+(Z2-Z1)^2 ]
Then multiply this by the velocity attribute of the particle, and I should have lifespan in seconds.
Lifespan = distance / velocity
Can anyone help me write this expression given the components names I mentioned? I have no clue how to write the syntax properly.
:sad:
