Static Particle Image

Creating scripts
Post Reply
User avatar
Gusher Castaignede
Posts: 55
Joined: Tue Mar 17, 2015 10:03 pm
Has thanked: 4 times
Been thanked: 26 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();    }}
User avatar
John Mela
Posts: 27
Joined: Tue Feb 04, 2014 9:50 pm
Has thanked: 28 times
Been thanked: 22 times

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: 55
Joined: Tue Mar 17, 2015 10:03 pm
Has thanked: 4 times
Been thanked: 26 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?
User avatar
John Mela
Posts: 27
Joined: Tue Feb 04, 2014 9:50 pm
Has thanked: 28 times
Been thanked: 22 times

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: 55
Joined: Tue Mar 17, 2015 10:03 pm
Has thanked: 4 times
Been thanked: 26 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.
User avatar
John Mela
Posts: 27
Joined: Tue Feb 04, 2014 9:50 pm
Has thanked: 28 times
Been thanked: 22 times

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.
Post Reply