secondlife / viewer

🖥️ Second Life's official client
GNU Lesser General Public License v2.1
209 stars 54 forks source link

Particles on child prims are not interpolated properly #959

Open canny[bot] opened 6 months ago

canny[bot] commented 6 months ago

If a child prim in a linkset has a particle effect and the child prim moves individually, i.e. not via motion or TargetOmega of the root prim, the particles are not interpolated unlike the child prim's own motion.

Steps to reproduce: make a linkset with 2 cubes, make prim 2 50% transparent so you can see the particles inside it.

Insert the following script in the root:


default

{

    state_entry()

    {

        integer MOVE_ROOT = FALSE; // set to TRUE to move the root, which has no interpolation issues

        llLinkParticleSystem(2, [ // set up child prim particle system

            PSYS_SRC_PATTERN, PSYS_SRC_PATTERN_DROP,

            PSYS_SRC_TEXTURE, "82e7dccf-5717-2601-05a2-0c6b86182b8e",

            PSYS_PART_MAX_AGE, 3/30.0,

            PSYS_SRC_BURST_RATE, 1/30.0,

            PSYS_SRC_BURST_PART_COUNT, 1,

            PSYS_PART_FLAGS,

                PSYS_PART_FOLLOW_SRC_MASK | // can comment out the follow_src, the issue persists

                PSYS_PART_EMISSIVE_MASK

        ]);

        float t;

        integer target = 2; // set up movement params

        vector base = ZERO_VECTOR;

        if(MOVE_ROOT) {

            base = llGetPos();

            target = LINK_ROOT;

            llSetLinkPrimitiveParamsFast(2, [PRIM_POS_LOCAL, <0, 1, 0>]);

        }

        while(TRUE) {

            llSetLinkPrimitiveParamsFast(target, [PRIM_POS_LOCAL, base+<0, llCos(t), llSin(t)>]);

            t += 0.07;

            if(t >= TWO_PI)

                t -= TWO_PI;

            llSleep(0.1);

        }

    }

}

You can see the particle blob will jitter and be ahead of the child prim's motion, not interpolated: it immediately snaps to the prim's true position instead of moving smoothly.

By setting the MOVE_ROOT to TRUE at the start of the script, it will move the root prim instead. The child prim particles are now interpolated correctly and follow the child prim's motion smoothly.

https://secondlife.canny.io/admin/board/bug-reports/p/particles-on-child-prims-are-not-interpolated-properly

canny[bot] commented 6 months ago

This issue has been linked to a Canny post: Particles on child prims are not interpolated properly :tada: