Static Particle Image

Creating scripts
Post Reply
User avatar
Gusher Castaignede
Posts: 258
Joined: Tue Mar 17, 2015 10:03 pm
Has thanked: 285 times
Been thanked: 250 times

Static Particle Image

Post by Gusher Castaignede »

I am trying to create a static particle sprite, but need it to follow camera view
horizontally, not vertically.... anyone know how to do that?

Code: Select all

default {    state_entry() {        string texture = llGetInventoryName(INVENTORY_TEXTURE, 0);        llParticleSystem([                    PSYS_PART_FLAGS, 
PSYS_PART_EMISSIVE_MASK,                    
PSYS_SRC_PATTERN, 4,                    
PSYS_PART_START_ALPHA, 1.0,       
PSYS_PART_END_ALPHA, 1.0,                    
PSYS_PART_START_COLOR, <1.0,1.0,1.0>,                   
PSYS_PART_END_COLOR, <1.0,1.0,1.0>,                   
PSYS_PART_START_SCALE, <1.0, 1.0, .0>,  
PSYS_PART_MAX_AGE, 1.20,                    
PSYS_SRC_MAX_AGE, 0.00,        
PSYS_SRC_ACCEL, <0.0,0.0,0.0>,
PSYS_SRC_ANGLE_BEGIN, 0.00,                 
PSYS_SRC_ANGLE_END, 0.00,   
PSYS_SRC_BURST_PART_COUNT, 8,               
PSYS_SRC_BURST_RADIUS, .75,                    
PSYS_SRC_BURST_RATE, 0.10,   
PSYS_SRC_BURST_SPEED_MIN, 0.00,                   
PSYS_SRC_BURST_SPEED_MAX, 0.00,             
PSYS_SRC_OMEGA, <0.00,0.00,0.00>,            
PSYS_SRC_TEXTURE, texture            ]);    }    changed(integer c) {        if (c & CHANGED_INVENTORY) llResetScript();    }}
Image
"lnteractivity, Variety, Ease of Use"
Visit my store at Country Manor
User avatar
John Mela
Posts: 91
Joined: Tue Feb 04, 2014 9:50 pm
Has thanked: 139 times
Been thanked: 127 times
Contact:

Re: Static Particle Image

Post by John Mela »

As far as I know, that isn't possible. Particle sprites are always rendered as facing the viewer on both axes (ie perpendicular to the camera direction).

Incidentally, that script places more load on the particle system than it needs to, by putting out 80 particles per second. I'd suggest something like this, which uses 1 particle every 10 seconds:

Code: Select all

default {
    state_entry() {
        string texture = llGetInventoryName(INVENTORY_TEXTURE, 0);
        llParticleSystem([
            PSYS_PART_FLAGS, PSYS_PART_EMISSIVE_MASK, PSYS_SRC_PATTERN, PSYS_SRC_PATTERN_ANGLE,
            PSYS_PART_START_ALPHA, 1.0,
            PSYS_PART_END_ALPHA, 1.0,
            PSYS_PART_START_COLOR, <1.0, 1.0, 1.0>,
            PSYS_PART_END_COLOR, <1.0, 1.0, 1.0>,
            PSYS_PART_START_SCALE, <1.0, 1.0, 0.0>,
            PSYS_PART_MAX_AGE, 10.0,
            PSYS_SRC_BURST_PART_COUNT, 1,
            PSYS_SRC_BURST_RADIUS, 0.75,
            PSYS_SRC_BURST_RATE, 9.0,
            PSYS_SRC_BURST_SPEED_MIN, 0.0,
            PSYS_SRC_BURST_SPEED_MAX, 0.0,
            PSYS_SRC_TEXTURE, texture
                ]);
    }
    changed(integer c) {
        if (c & CHANGED_INVENTORY) llResetScript();
    }
}
These users thanked the author John Mela for the post:
Ilan Tochner
User avatar
Gusher Castaignede
Posts: 258
Joined: Tue Mar 17, 2015 10:03 pm
Has thanked: 285 times
Been thanked: 250 times

Re: Static Particle Image

Post by Gusher Castaignede »

Thanks alot John.....

any way to script a prim to do follow camera view on single axis?
Image
"lnteractivity, Variety, Ease of Use"
Visit my store at Country Manor
User avatar
John Mela
Posts: 91
Joined: Tue Feb 04, 2014 9:50 pm
Has thanked: 139 times
Been thanked: 127 times
Contact:

Re: Static Particle Image

Post by John Mela »

It would be possible to have a timer running that turned the prim to face a given avatar on given axis/axes. It wouldn't be anything like as efficient as a particle solution, as it would produce CPU load on the server CPU when the timer kicked in each time.

You can find the position of any avatar in the region using llGetObjectDetails, and rotate the prim using llSetRot - the rest is just calculations.
User avatar
Gusher Castaignede
Posts: 258
Joined: Tue Mar 17, 2015 10:03 pm
Has thanked: 285 times
Been thanked: 250 times

Re: Static Particle Image

Post by Gusher Castaignede »

If its server side its probaby not a good idea.... should be clientside and work for multiple avatars at same time.... what am trying to do are animated billboards; I did this at Sansar recently...

[youtube]https://youtu.be/kh7q6MBBIhI[/youtube]
John Mela wrote:
Tue Feb 25, 2020 6:31 pm
It would be possible to have a timer running that turned the prim to face a given avatar on given axis/axes. It wouldn't be anything like as efficient as a particle solution, as it would produce CPU load on the server CPU when the timer kicked in each time.

You can find the position of any avatar in the region using llGetObjectDetails, and rotate the prim using llSetRot - the rest is just calculations.
Image
"lnteractivity, Variety, Ease of Use"
Visit my store at Country Manor
User avatar
John Mela
Posts: 91
Joined: Tue Feb 04, 2014 9:50 pm
Has thanked: 139 times
Been thanked: 127 times
Contact:

Re: Static Particle Image

Post by John Mela »

Yes, ideally we'd be able to do this client-side, but unfortunately that's not possible.
User avatar
Krull Kitty
Posts: 100
Joined: Thu Aug 06, 2020 1:25 pm
Has thanked: 39 times
Been thanked: 81 times

Re: Static Particle Image

Post by Krull Kitty »

This is what I call "Particle System 4" because the PSYS_SRC_PATTERN is set to 4
I put this in a subroutine and assign a global variable called "texture" in the declarations
section. This allows me to set the texture of the particle field from anywhere in the script
and calling the "parton();" subroutine again which then updates the texture on the particle field
using the updated global variable value.

string texture = ""; << Declaration as string because the particle system only accepts the UUID of the
<< texture as a string. So when detecting inventory textures be sure to recast as a string.

Code: Select all

parton()
{
        llParticleSystem([
            PSYS_PART_FLAGS, PSYS_PART_EMISSIVE_MASK,
            PSYS_SRC_PATTERN, 4,
            PSYS_PART_START_ALPHA, 1.0,
            PSYS_PART_END_ALPHA, 1.0,
            PSYS_PART_START_COLOR, <1.0,1.0,1.0>,
            PSYS_PART_END_COLOR, <1.0,1.0,1.0>,
            PSYS_PART_START_SCALE, <1.130,2.523,0.0>, //<Size * 1.6 ,Size,0.00>,
            PSYS_PART_END_SCALE, <1.130,2.523,0.0>, //<Size * 1.6,Size,0.00>,
            PSYS_PART_MAX_AGE, 1.20,
            PSYS_SRC_MAX_AGE, 0.00,
            PSYS_SRC_ACCEL, <0.0,0.0,0.00>,
            PSYS_SRC_ANGLE_BEGIN, 0.00,
            PSYS_SRC_ANGLE_END, 0.00,
            PSYS_SRC_BURST_PART_COUNT, 16,
            PSYS_SRC_BURST_RADIUS, Height,
            PSYS_SRC_BURST_RATE, 0.10,
            PSYS_SRC_BURST_SPEED_MIN, 0.00,
            PSYS_SRC_BURST_SPEED_MAX, 0.00,
            PSYS_SRC_OMEGA, <0.00,0.00,0.00>,
            PSYS_SRC_TEXTURE, texture]);    //The updated string global is then reloaded in the particle system when this routine
}                                                             //is recalled from within the script.
Post Reply