Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

How to make particle emitter face a direction?

Ug Llewellyn
Registered User
Join date: 30 Nov 2007
Posts: 4
12-04-2007 18:27
How do you get a particle emitter to face a particular direction? For example, I have created a rocket engine and I want the particles always to come out of the bottom, but the rocket engine can be pointed in any direction.

I would like info about how to EITHER:
1) Fix the particle emitter to ALWAYS face a particular direction in relation to the object.
2) Just point the particle emitter somewhere other than the positive Z axis.
Mrc Homewood
Mentor of Randomness
Join date: 24 Feb 2007
Posts: 779
12-04-2007 19:11
PSYS_PART_BOUNCE_MASK is the key to the dirrection

http://wiki.secondlife.com/wiki/LlParticleSystem
Void Singer
Int vSelf = Sing(void);
Join date: 24 Sep 2005
Posts: 6,973
12-04-2007 20:20
I think Mrc meant PSYS_PART_FOLLOW_SRC_MASK
_____________________
|
| . "Cat-Like Typing Detected"
| . This post may contain errors in logic, spelling, and
| . grammar known to the SL populace to cause confusion
|
| - Please Use PHP tags when posting scripts/code, Thanks.
| - Can't See PHP or URL Tags Correctly? Check Out This Link...
| -
Ug Llewellyn
Registered User
Join date: 30 Nov 2007
Posts: 4
12-04-2007 20:34
From: Void Singer
I think Mrc meant PSYS_PART_FOLLOW_SRC_MASK


Ok, so I think what you are saying is that the emitter will rotate as the object rotates...correct?

Now, how do I set the initial direction of the emitter? Right now, I am stuck with smoke particles coming out the side of my engine instead of the bottom.
Void Singer
Int vSelf = Sing(void);
Join date: 24 Sep 2005
Posts: 6,973
12-04-2007 20:54
From: Ug Llewellyn
Ok, so I think what you are saying is that the emitter will rotate as the object rotates...correct?

Now, how do I set the initial direction of the emitter? Right now, I am stuck with smoke particles coming out the side of my engine instead of the bottom.

I'll assume those smoke particles are set to be affected by wind? either move your emitter lower (say near the end?) or you could play around with PSYS_SRC_ACCEL and a rotated point (<.0, .0, -1.0> * llGetRot(); perhaps?), with the caveat that if the rocket rotates, the particle system would need to be called again to give a correct direction for these particles. all this is assuming you have you emitter rotated to a correct direction
_____________________
|
| . "Cat-Like Typing Detected"
| . This post may contain errors in logic, spelling, and
| . grammar known to the SL populace to cause confusion
|
| - Please Use PHP tags when posting scripts/code, Thanks.
| - Can't See PHP or URL Tags Correctly? Check Out This Link...
| -
Ug Llewellyn
Registered User
Join date: 30 Nov 2007
Posts: 4
12-04-2007 21:20
From: someone
all this is assuming you have you emitter rotated to a correct direction


That's what I'm asking. How do I rotate it to the correct direction in the first place? Right now it is rotated so that smoke comes out the side when I do the PSYS_SRC_PATTERN_ANGLE_CONE. Now, I could do the PSYS_SRC_ANGLE_BEGIN and PSYS_SRC_ANGLE_END such that smoke would come from the bottom, but due to the fact that these are essentially angles (specifically phi) in a spherical coordinate system.

Here is the problem if I didn't make it clear:

(top)
| |
| | -> smoke
| |
(bottom)

I want smoke to come out of the bottom. Help me rotate the particle emitter.
Void Singer
Int vSelf = Sing(void);
Join date: 24 Sep 2005
Posts: 6,973
12-04-2007 21:28
From: Ug Llewellyn
That's what I'm asking. How do I rotate it to the correct direction in the first place? Right now it is rotated so that smoke comes out the side when I do the PSYS_SRC_PATTERN_ANGLE_CONE. Now, I could do the PSYS_SRC_ANGLE_BEGIN and PSYS_SRC_ANGLE_END such that smoke would come from the bottom, but due to the fact that these are essentially angles (specifically phi) in a spherical coordinate system.

Here is the problem if I didn't make it clear:

(top)
| |
| | -> smoke
| |
(bottom)

I want smoke to come out of the bottom. Help me rotate the particle emitter.

ah I see where the confusion is... that is a single cyllinder prim you're describing there as the emmiter? use a profile cut on the cylinder, at .5, and double your z size... position accordingly.

particles emit from prim center.

the other choice is to create a seperate prim, with the above mentioned flag set you should be able to physically rotate that prim to get you desired facing (IIRC)
_____________________
|
| . "Cat-Like Typing Detected"
| . This post may contain errors in logic, spelling, and
| . grammar known to the SL populace to cause confusion
|
| - Please Use PHP tags when posting scripts/code, Thanks.
| - Can't See PHP or URL Tags Correctly? Check Out This Link...
| -
Ryder Spearmann
Early Adopter
Join date: 1 May 2006
Posts: 216
12-05-2007 20:55
From: Void Singer
ah I see where the confusion is... that is a single cyllinder prim you're describing there as the emmiter? use a profile cut on the cylinder, at .5, and double your z size... position accordingly.

particles emit from prim center.

the other choice is to create a seperate prim, with the above mentioned flag set you should be able to physically rotate that prim to get you desired facing (IIRC)



No, I don't think Ug is saying that at all.

I think the question is about direction. NOT origin. Particles come out of a rocket engine in ONE DIRECTION. rocket flames coming out of the SIDE of the engine makes no sense. We need to help Ug get particles to flow downward (when the nozzle is facing down).

I have the exact same issue. I have a gun, that when pointed away from me to the horizon, shoots my foot. My particle bullet is NOT heading in the direction of my barrel.

My guess is that we are both using the TUBE prim as our particle emitter. Source angles of 0.0 or PI exit out the side of the prim... not along the tube.

Using a different prim is not an option.
Adding a prim is not an option.
Void Singer
Int vSelf = Sing(void);
Join date: 24 Sep 2005
Posts: 6,973
12-05-2007 22:59
part of the problem here is that if wind interaction is set, the particles, which are generated at prim center, will be affected by it before making it down to the end. the solution is to cute the prim so that the center, is the apparent end...

the other possible problem is that the particle source seems tied to a new direction (+x?), whic I can't test not being inworld... the solution there is to rotate the prim untill they face the direction you want, but since it's a cylinder that kind of defeats the design purpose, so the solution would be to add/use a prim that CAN be rotated without trashing the physical design... the extra prim could be anything, and maybe even invisible...

now my original assumption was that it would maintain it's positive z facing, but obviously that's not the case if it's flying out the side of a cylinder...

another possible workaround for op would be to place an invisible target prim out past the rockets tail, target it from the cylinder with flame particles, and have said invisible prim generate the smoke particles...

similarly your gun could generate an invisible target prim and fire at it.

that's about the only choice I can think of if you can't rotate the prim the emitter is in.
_____________________
|
| . "Cat-Like Typing Detected"
| . This post may contain errors in logic, spelling, and
| . grammar known to the SL populace to cause confusion
|
| - Please Use PHP tags when posting scripts/code, Thanks.
| - Can't See PHP or URL Tags Correctly? Check Out This Link...
| -
Debbie Trilling
Our Lady of Peenemünde
Join date: 17 Oct 2006
Posts: 434
12-06-2007 01:53
See /54/4f/209783/1.html

which gives an explanation of and simple example of how to set up PSYS_PART_FOLLOW_SRC_MASK and getting particles to emit in a specific direction.

For the specific OP, I'd consider adding a small seperate invisible prim at the correct position/rotation attached to the main prim to control the particle emision, rather than attempting to have the main prim emit.


From: Mrc Homewood

PSYS_PART_BOUNCE_MASK is the key to the dirrection


This is simply incorrect. See http://wiki.secondlife.com/wiki/LlParticleSystem
Mrc Homewood
Mentor of Randomness
Join date: 24 Feb 2007
Posts: 779
12-06-2007 05:08
oops hehe i was tired that night ^^
Debbie Trilling
Our Lady of Peenemünde
Join date: 17 Oct 2006
Posts: 434
12-06-2007 05:19
The following llParticleSystem call will bellow smoke out of the end of a cylinder (not a tube) regardless the direction that that end is pointing (that is, it's rotation).

From: someone


llParticleSystem([
PSYS_PART_FLAGS, PSYS_PART_FOLLOW_SRC_MASK,
PSYS_SRC_PATTERN, 4,
PSYS_PART_START_ALPHA, 0.30,
PSYS_PART_END_ALPHA, 0.00,
PSYS_PART_START_COLOR, <0.75,0.75,0.75>,
PSYS_PART_END_COLOR, <0.35,0.35,0.35>,
PSYS_PART_START_SCALE, <1.25,1.25,0.00>,
PSYS_PART_END_SCALE, <1.50,1.50,0.00>,
PSYS_PART_MAX_AGE, 1.250,
PSYS_SRC_MAX_AGE, 0.00,
PSYS_SRC_ACCEL, <0.00,0.00,0.00>,
PSYS_SRC_ANGLE_BEGIN, 0.00,
PSYS_SRC_ANGLE_END, 0.35,
PSYS_SRC_BURST_PART_COUNT, 1,
PSYS_SRC_BURST_RADIUS, 0.00,
PSYS_SRC_BURST_RATE, 0.10,
PSYS_SRC_BURST_SPEED_MIN, 3.75,
PSYS_SRC_BURST_SPEED_MAX, 4.25,
PSYS_SRC_OMEGA, <0.00,0.00,0.00>,
PSYS_SRC_TEXTURE, "d114fcdd-8e66-5525-66c7-da5d0cd233c1"
]);



Keep PSYS_PART_FOLLOW_SRC_MASK in place but add any other necessary flags for the effect that you are trying to create; change the texture, colour, speed, size etc etc to suit.

With this particular effect, if PSYS_SRC_BURST_SPEED_MIN and/or PSYS_SRC_BURST_SPEED_MAX gets lower than a certain threshold, then the whole effect collapses and looks awful. So, for this type of effect speed is of the essence...

...and PSYS_PART_FOLLOW_SRC_MASK, of course :)
Talarus Luan
Ancient Archaean Dragon
Join date: 18 Mar 2006
Posts: 4,831
12-06-2007 07:43
If you are asking if there is a way to rotate the particle emitter independently of the prim, there isn't one. Except in the case of Omega, the emitter is welded to the positive Z axis of the emitter's prim. It's also a lament of mine that they didn't include something like a PSYS_SRC_ROTATION option.

Now, you CAN "spin" the particle emitter, a la PSYS_SRC_OMEGA, but that doesn't sound like what you are wanting.

The workaround is using a tiny, invisible linked prim which you can rotate, as already suggested.
Beverly Ultsch
Registered User
Join date: 6 Sep 2007
Posts: 229
12-06-2007 08:06
I think Debbie has put her finger on the problem, can we clarify, is the prim in question a tube, cylinder or torus this affects what the particles will do.

Not true, the Z axis will decide what the particles will do, the type of prim will decide where the z axis is.
Talarus Luan
Ancient Archaean Dragon
Join date: 18 Mar 2006
Posts: 4,831
12-06-2007 08:50
Not sure what you mean. The type of prim doesn't change where the z-axis is relative to the prim. IE, if I use llSetPrimitiveParams to change the PRIM_TYPE, the local z-axis won't move or change as a result.

Now, what is considered the local z-axis for different kinds of prims you can consider "different", but then again, the prim IS "different", so that is to be expected.
Beverly Ultsch
Registered User
Join date: 6 Sep 2007
Posts: 229
12-06-2007 09:42
Sorry if i didnt explain thatwell, late night.

rez the following.

1} cylinder - to make it look like a rocket extend the Z axis

2: tube or torus - to make it look like a rocket extend the x axis.

particle will follow the z axis, in world co-ords this is different between 1 and 2.

in 1) it is up and down, in 2 it is left to right.

the particles still follow the z axis but it points in a different direction.

a tube made from 1) will have partiles going up or down - from 2) it will have them going left to right.

[Edit] my guess is that the rocket is a tube or a torus so the particles come out the wrong way
Ryder Spearmann
Early Adopter
Join date: 1 May 2006
Posts: 216
12-06-2007 21:14
From: Beverly Ultsch
I think Debbie has put her finger on the problem, can we clarify, is the prim in question a tube, cylinder or torus this affects what the particles will do.

Not true, the Z axis will decide what the particles will do, the type of prim will decide where the z axis is.


back in post #8, I state that I, and I surmize the base poster, are using a Tube.
Johan Laurasia
Fully Rezzed
Join date: 31 Oct 2006
Posts: 1,394
12-08-2007 06:59
The answer is simple, apply a force (acceleration) in the direction (positive or negative) that you want the particles to go.
Talarus Luan
Ancient Archaean Dragon
Join date: 18 Mar 2006
Posts: 4,831
12-08-2007 10:13
From: Johan Laurasia
The answer is simple, apply a force (acceleration) in the direction (positive or negative) that you want the particles to go.


The problem is that PSYS_SRC_ACCEL is always relative to the global axes, not the emitter axes, so no, that is not the answer. Sorry. :)
Beverly Ultsch
Registered User
Join date: 6 Sep 2007
Posts: 229
12-08-2007 12:24
The simple answer is to change the tube for a cylinder :)

However if that is not possible then I think you have to use PSYS_SRC_ACCEL, but its a horrid solution and the maths are beyond my poor brain :(.

You would have to calculate the acceleration to be applied based on the rotation of the object, then you need something to trigger reseting the particle system (no CHANGED_ROTATION event). In this case you may be able to use the CONTROL event, given that its a rocket and is probably using this event. Thats the only way I can see of doing it, but I wouldnt even know where to start on the code .
DrDoug Pennell
e-mail is for old people
Join date: 13 Mar 2007
Posts: 112
12-10-2007 08:37
This is not exactly on the topic of this thread but it is sorta related and this thread seems to have taken a break, so I'll post here and apologize if this is inappropriate.

I can create a cylinder and get the particles to come out the top. So far so good.

After they come out of the top of my cylinder, I need the particles to turn and head towards another object. The size and shape of the objects won't matter as I will probably make them transparent. Actually I just need them to turn and head down field and figured that I would need a target for that.

I can't rely on the wind for this (curving) effect since it seems to blow every which way up here. I also can't rely on gravity.

I realize I could probably put some intermediate (invisible) targets along the path but I'm already using a zillion prim for this project and I'll have a LOT of these particular particle emitters. I suppose I could have them track an invisible target moving in the right direction but that will get messy too.

Any other way to get the particles to reliably turn in the direction you want?

Thanks,

Doug
Void Singer
Int vSelf = Sing(void);
Join date: 24 Sep 2005
Posts: 6,973
12-10-2007 12:32
@Doug:
yes, yes follow_src, and the target uuid will be a down field object. to keep the objects from going straight there, use Accel to push them up first.... so that they will go up, then travel down field... pretty sure that works
_____________________
|
| . "Cat-Like Typing Detected"
| . This post may contain errors in logic, spelling, and
| . grammar known to the SL populace to cause confusion
|
| - Please Use PHP tags when posting scripts/code, Thanks.
| - Can't See PHP or URL Tags Correctly? Check Out This Link...
| -