Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

perticually Prickly Particle Problem

Muzutsu Hanfoi
Registered User
Join date: 2 Apr 2008
Posts: 3
05-04-2009 10:20
Hi all
I've been toiling for the last few hours now with a particle script, one of the freebie ones from the LSL portal. Sadly my toiling was fruitless. Allow me to explain my predicament.

I'm trying to create a wrist mounted flamethrower, Of course this uses particle effects and an invisible bullet. The shooting code i have no problem with, same with the animations and everything. However when i come to add the particle effects i hit a rather large blunder. The flame effect always shoots off toward North, after a lot of changing random values i managed to find the correct one to change in order to adjust the angle the flame shoots at. Sadly i am still unable to make the particles shoot in the direction my avatar is facing.

I attempted to do it the same way they do in gun scripts, but sadly this didn't work. The particles just hovered in front of me and did nothing, i also found that llGetRot() will return the way the avatar is facing if its triggered when in mouselook. But again with the cunning use of llRot2Euler(llGetRot()); all i get is a bunch of particles in my face.

So in short, I'm attempting to make particles travel in the direction i am facing. I'm sure this must be possible and its no doubt just me being a silly bugger. But if anyone could help me out that would be super.

Thanks

Muzu

P.S. I already tried having an invisible prim placed infront and using that as a target. Didn't work.

P.P.S On a side note, does anyone know of a SL animation tool that works on Linux?
Void Singer
Int vSelf = Sing(void);
Join date: 24 Sep 2005
Posts: 6,973
05-04-2009 11:01
you need to give your particles a relative target. which would be and offset rotated by your av's rotation. say you want it to shoot 5m in front of you

<5.0, 0.0, 0.0> * Av's_Rotation (+ av's position?)= target vector.

you can get av rotation on touch from the llDetectedRot, from a sensor (on in a chid prim on attachments) using the same function.

llGetObjectDetails can also get av rotation.

you can also target a specific av with any of those methods and get their location for the target vector, but this will ignore your facing.

another option is to animate a prim extension from the front of your attachment (instead of the particles), which will always obey both av rotation and any animations playing.
_____________________
|
| . "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...
| -
Argent Stonecutter
Emergency Mustelid
Join date: 20 Sep 2005
Posts: 20,263
05-04-2009 11:06
You don't need to do any calculations or any complex scripting. Just have the particles emitted along the axis of some prim... not targeted at all... then attach the prim to the weapon and rotate it until it's pointing in the right direction relative to the weapon. There may be a prim already in the weapon that happens to be rotated correctly, but if not you cal always add another and make it 100% transparent.
_____________________
Argent Stonecutter - http://globalcausalityviolation.blogspot.com/

"And now I'm going to show you something really cool."

Skyhook Station - http://xrl.us/skyhook23
Coonspiracy Store - http://xrl.us/coonstore
Muzutsu Hanfoi
Registered User
Join date: 2 Apr 2008
Posts: 3
05-04-2009 13:16
Thank you both for your suggestions,
sadly i couldn't get anything to work. The llDetectedRot() idea didn't seem to do much, and to be honest the calculation you did slightly confused me somewhat. As for the the Prim idea, this could have legs, only i would loose out on the animation side of things without it being laggy.

Is their no simple way to just fire particles in the way im facing? Surely there must be a simple way of doing this...no?
Argent Stonecutter
Emergency Mustelid
Join date: 20 Sep 2005
Posts: 20,263
05-04-2009 13:45
From: Muzutsu Hanfoi

Is their no simple way to just fire particles in the way im facing?
Attach a prim facing the same direction, and fire the particles from that. I can't think of any other approach that is even vaguely possible, and it seems pretty simple to me. What is your objection, I don't really understand it?
_____________________
Argent Stonecutter - http://globalcausalityviolation.blogspot.com/

"And now I'm going to show you something really cool."

Skyhook Station - http://xrl.us/skyhook23
Coonspiracy Store - http://xrl.us/coonstore
Muzutsu Hanfoi
Registered User
Join date: 2 Apr 2008
Posts: 3
05-04-2009 14:02
The particles don't just fire forwards, You have to set an acceleration vector. <x,y,z>.

I can have a prim facing anyway i like, but unless i can set that vector to the way I'm facing, The Particles will always fly off in a random direction or just hover around me. I can get the rotation of my avatar by using llGetRot() in mouselook, but when i convert that to a vector using llRot2Euler(rot) It just..doesn't like it, the particles either fly off randomly, or shoot straight up.
Argent Stonecutter
Emergency Mustelid
Join date: 20 Sep 2005
Posts: 20,263
05-04-2009 14:24
From: Muzutsu Hanfoi
The particles don't just fire forwards, You have to set an acceleration vector. <x,y,z>.
You don't need to set an acceleration vector unless you want to simulate the effects of gravity or bouyancy. Particles fire in a variety of patterns, including a cone or an arc. Create a particle system with PSYS_SRC_PATTERN_ANGLE_CONE and with PSYS_SRC_ANGLE_BEGIN and PSYS_SRC_ANGLE_END set to fire the particles in a narrow beam, then use PSYS_SRC_BURST_SPEED_MIN and PSYS_SRC_BURST_SPEED_MAX to get the flame effect you want. This will get you a stream of particles emitted from the prim that will turn with the prim. THEN you can look at applying a small upwards vector to simulate the way the hot air around the flame makes it rise.
_____________________
Argent Stonecutter - http://globalcausalityviolation.blogspot.com/

"And now I'm going to show you something really cool."

Skyhook Station - http://xrl.us/skyhook23
Coonspiracy Store - http://xrl.us/coonstore
Void Singer
Int vSelf = Sing(void);
Join date: 24 Sep 2005
Posts: 6,973
05-04-2009 14:28
assuming you need the to use PSYS_PART_FOLLOW_VELOCITY_MASK then you set the velocity according to formula above. (remove the ll get position I think, it says region coordinates, but I think it's region offset.

if you don't need that (because you aren't orienting a particle image) then just don't set PSYS_SRC_PATTERN_DROP and it should just fire straight out the front (+X) of the emitter regardless of animation or facing
_____________________
|
| . "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...
| -
Argent Stonecutter
Emergency Mustelid
Join date: 20 Sep 2005
Posts: 20,263
05-04-2009 14:48
From: Void Singer
if you don't need that (because you aren't orienting a particle image) then just don't set PSYS_SRC_PATTERN_DROP and it should just fire straight out the front (+X) of the emitter regardless of animation or facing
PSYS_SRC_PATTERN_DROP will release the particles with no velocity at all. You really don't want to do that for a flamethrower.
_____________________
Argent Stonecutter - http://globalcausalityviolation.blogspot.com/

"And now I'm going to show you something really cool."

Skyhook Station - http://xrl.us/skyhook23
Coonspiracy Store - http://xrl.us/coonstore
Jesse Barnett
500,000 scoville units
Join date: 21 May 2006
Posts: 4,160
05-04-2009 15:31
I dropped a plain prim with a jet flame in it in world for you to look at. Wear it from inventory and touch it to turn off and on. The jet is pointed where ever the hand is pointed. This is what Argent was trying to explain. The script is mod so you can take a look at the integer switch for off and on.

If you need some help creating the particle effect itself, search in world for the Particle Laboratory. It has EVERYTHING a person needs to learn particles.
_____________________
I (who is a she not a he) reserve the right to exercise selective comprehension of the OP's question at anytime.
From: someone
I am still around, just no longer here. See you across the aisle. Hope LL burns in hell for archiving this forum
Void Singer
Int vSelf = Sing(void);
Join date: 24 Sep 2005
Posts: 6,973
05-04-2009 16:21
From: Argent Stonecutter
PSYS_SRC_PATTERN_DROP will release the particles with no velocity at all. You really don't want to do that for a flamethrower.

I know which is why I said DON'T set it =)
_____________________
|
| . "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...
| -
Jesse Barnett
500,000 scoville units
Join date: 21 May 2006
Posts: 4,160
05-04-2009 16:41
From: Void Singer
I know which is why I said DON'T set it =)

OH! Your here? I didn't notice :p

Poor Void is going to end up with a complex. Everyone ignores her.

When I was married we would all be at the table for dinner and I would talk for 10 minutes to my ex. Eventually he would look up and say something along the lines of; "Oh you were talking to me? I thought you were talking to Samantha."
_____________________
I (who is a she not a he) reserve the right to exercise selective comprehension of the OP's question at anytime.
From: someone
I am still around, just no longer here. See you across the aisle. Hope LL burns in hell for archiving this forum
Ruthven Willenov
Darkness in your light
Join date: 16 Jan 2008
Posts: 965
05-04-2009 19:25
From: Jesse Barnett


When I was married we would all be at the table for dinner and I would talk for 10 minutes to my ex. Eventually he would look up and say something along the lines of; "Oh you were talking to me? I thought you were talking to Samantha."


is that part of the reason he's an ex? lol
_____________________
Dark Heart Emporium

http://www.xstreetsl.com/modules.php?name=Marketplace&MerchantID=133020

want more layers for tattoos, specifically for the head? vote here
http://jira.secondlife.com/browse/VWR-1449?

llDetectedCollision* Functions similar to touch
http://jira.secondlife.com/browse/SVC-3369
Argent Stonecutter
Emergency Mustelid
Join date: 20 Sep 2005
Posts: 20,263
05-04-2009 19:50
From: Void Singer
I know which is why I said DON'T set it =)
You can't just "not set it", you have to set SOME kind of pattern.
_____________________
Argent Stonecutter - http://globalcausalityviolation.blogspot.com/

"And now I'm going to show you something really cool."

Skyhook Station - http://xrl.us/skyhook23
Coonspiracy Store - http://xrl.us/coonstore
Nexii Malthus
[Cubitar]Mothership
Join date: 24 Apr 2006
Posts: 400
05-04-2009 20:25
You can just not set it by setting it to any other kind of pattern, but yeah english sucks.
_____________________

Geometric Library, for all your 3D maths needs.
https://wiki.secondlife.com/wiki/Geometric

Creator of the Vertical Life Client
Void Singer
Int vSelf = Sing(void);
Join date: 24 Sep 2005
Posts: 6,973
05-04-2009 23:50
bit field so of course you can 'not' set it

although I shouldve been clearer and said use PSYS_SRC_PATTERN_ANGLE_CONE only (as I assume OP's wanting at least a slight spread, and using that)

but this is why I hate answering blind particle questions... too many assumptions in that one w/o seeing the call. =/
_____________________
|
| . "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...
| -
Argent Stonecutter
Emergency Mustelid
Join date: 20 Sep 2005
Posts: 20,263
05-05-2009 01:35
From: Void Singer
bit field so of course you can 'not' set it
PSYS_SRC_PATTERN_* isn't a bit field. It's an integer parameter to PSYS_SRC_PATTERN. :) The values look like a mask but they don't work that way.
_____________________
Argent Stonecutter - http://globalcausalityviolation.blogspot.com/

"And now I'm going to show you something really cool."

Skyhook Station - http://xrl.us/skyhook23
Coonspiracy Store - http://xrl.us/coonstore
Void Singer
Int vSelf = Sing(void);
Join date: 24 Sep 2005
Posts: 6,973
05-05-2009 11:44
From: Argent Stonecutter
PSYS_SRC_PATTERN_* isn't a bit field. It's an integer parameter to PSYS_SRC_PATTERN. :) The values look like a mask but they don't work that way.

well actually they are laid out and a bit mask, but I guess you can't 'or' them so ::shrug::

new word(s) 'instead of'

PS what nit thought it was a good idea to layout an exclusive bit field?very counter intuitive and artificially limiting
_____________________
|
| . "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...
| -
Argent Stonecutter
Emergency Mustelid
Join date: 20 Sep 2005
Posts: 20,263
05-05-2009 11:47
From: Void Singer
PS what nit thought it was a good idea to layout an exclusive bit field?very counter intuitive and artificially limiting
It jest growed lik cabbages, maam.
_____________________
Argent Stonecutter - http://globalcausalityviolation.blogspot.com/

"And now I'm going to show you something really cool."

Skyhook Station - http://xrl.us/skyhook23
Coonspiracy Store - http://xrl.us/coonstore