Jump to content

Using GetRot for Accel in particle emitters


Annie Arellano
 Share

You are about to reply to a thread that has been inactive for 4805 days.

Please take a moment to consider if this thread is worth bumping.

Recommended Posts

I'm trying to make a particle emitter attachment that requires the use of the Accel vector. My problem is that I cannot get it to push locally by avatar rotation and not sim rotation. I've implemented llGetRot and it does work but only for the rotation of the prim when the script first starts and it does not follow it after that. If I put in a blank root prim and used ||GetRootRotation instead would that follow the root's rotation constantly or will it only check upon startup like ||GetRot is doing? Is there an extra bit of code I need to add?

Any help is greatly appreciated!

Link to comment
Share on other sites

You might try something like

llLookAt(<1.0,0.0,0.0>*llGetRot(),1.0,0.5)

If you are updating with a timer as the avatar moves so that the script always has a current value of the av's global rotation to work with, I think the emitter prim ought to track with its +Z axis pointing forward all the time.

ETA:  That will position the prim.  The acceleration applied to particles shouldn't need a rotation correction at all.  I think that acceleration is always applied in the local rotation frame of the prim, IIRC.

ETA2: Oh, duh.  You said this is an attachment. I was thinking it was a follower. An attachment will rotate with your av anyway.  No magic needed.

Link to comment
Share on other sites

OK, forget my earlier post.  I just tried this as an experiment.  It's not the prettiest particle display in the world, but if you put it in a prim, point its +Z axis forward, and attach it to your av (I attached mine to the stomach), it produces a particle stream that always points away from your av as you turn.  Turn it on with /8 ON and off with /8 OFF.

 

default {        state_entry()    {        llListen(8,"",llGetOwner(),"");    }        listen(integer channel, string name, key id, string msg)    {        if ( llToUpper(msg) == "OFF")         {             llParticleSystem( [ ] );            llSetTimerEvent(0.0);        }         else if (llToUpper(msg) == "ON")         {             llSetTimerEvent(1.0);        }    }        timer()    {        llParticleSystem([             PSYS_SRC_TEXTURE, llGetInventoryName(INVENTORY_TEXTURE, 0),           PSYS_PART_START_SCALE, <0.051, 1.0, FALSE>, PSYS_PART_END_SCALE, <0.05, 1.0, FALSE>,            PSYS_PART_START_COLOR, <.25,.25,1.0>,    PSYS_PART_END_COLOR, <.75,0.00,0.00>,            PSYS_PART_START_ALPHA, (float) 1.0,         PSYS_PART_END_ALPHA, (float) .5,                PSYS_SRC_BURST_PART_COUNT, (integer)  5,            PSYS_SRC_BURST_RATE,         (float) 0.1,             PSYS_PART_MAX_AGE,           (float)  0.5,            PSYS_SRC_PATTERN, (integer) 8,            PSYS_SRC_BURST_SPEED_MIN, (float) 0.00,   PSYS_SRC_BURST_SPEED_MAX, (float) 5.0,            PSYS_SRC_ANGLE_BEGIN, (float) 0.00 * PI,   PSYS_SRC_ANGLE_END, (float) 0.00 * PI,             PSYS_SRC_ACCEL, < 20.00, 00.00, 0.0>*llGetRot(),                              PSYS_PART_FLAGS, (integer) ( 0                                                       | PSYS_PART_INTERP_COLOR_MASK                                   | PSYS_PART_INTERP_SCALE_MASK                                   | PSYS_PART_EMISSIVE_MASK                                   | PSYS_PART_FOLLOW_VELOCITY_MASK        )]);    }                }

 You could get it to track your movements even closer by speeding up the timer, at the potential cost of some lag.

 

Link to comment
Share on other sites

Basically I'm trying to make an emitter for smoke rings out of an avatars mouth. So in the code I have to keep the rings together for the most part so unfortunately Burst Speed must be the same and the angle Begin must be 1*PI, hence the issue with having to use accel to force the particle ring forward otherwise it just bursts outwards around the prim.

I don't know if that is somehow effecting GetRot so that it isn't working or not. I did start from scratch with the code posted and changed the particle settings to what is needed and it still headed for the global sim positioning instead of the avatar, even with a reset. 

Link to comment
Share on other sites

@ Annie, I'm glad you made it here :-)  Note that the instructions to the particle-emitter are only executed once, however long the particles are emitted for.  You will not be able to affect the behaviour of particles after they have been emitted.  Then again, that's just like blowing your smoke ring and then walking/turning away from it.  For EACH smoke-ring you need to calculate the direction, issue the particle-system command and then stop emitting particles with llParticleSystem([]);

@ Others - this is continuation of a question asked in the Answers section.  The issue is that the PSYS_SRC_ACCEL rule of the particle system takes a vector parameter.  Annie needs to know how to calculate that vector so it always accelerates the particles in the direction the avatar is facing.

(I need to run and it always takes me a couple of hours to get my head around (pun?) rotations each time I look at them again)

Edit: I suggested the vector needs to be multiplied by llGetRot() and I see that's what Rolig is doing.  Good ho! (if it works)

Link to comment
Share on other sites

You are about to reply to a thread that has been inactive for 4805 days.

Please take a moment to consider if this thread is worth bumping.

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
 Share

×
×
  • Create New...