Page 1 of 1

Static Particle Image

Posted: Mon Feb 24, 2020 8:39 pm
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();    }}

Re: Static Particle Image

Posted: Tue Feb 25, 2020 3:55 pm
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();
    }
}

Re: Static Particle Image

Posted: Tue Feb 25, 2020 5:18 pm
by Gusher Castaignede
Thanks alot John.....

any way to script a prim to do follow camera view on single axis?

Re: Static Particle Image

Posted: Tue Feb 25, 2020 6:31 pm
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.

Re: Static Particle Image

Posted: Tue Feb 25, 2020 7:35 pm
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.

Re: Static Particle Image

Posted: Thu Feb 27, 2020 4:01 am
by John Mela
Yes, ideally we'd be able to do this client-side, but unfortunately that's not possible.

Re: Static Particle Image

Posted: Fri Oct 02, 2020 12:30 am
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.