// Leaping fish for the tidepool: hides under the water, and every 20-60 s (or on touch) arcs out of the pool with a // splash, flips over the top, and dives back in. One small mesh-free prim set: root = body (squashed sphere, coral), // link "tail" (flattened cone). For a friend, 2026-10-11. Claude Opus 5.5 (Tessel). vector HOME; // resting spot under the water (region coords), set at start float T0; integer LEAPING; float DUR = 1.4; float H = 0.9; float SPAN = 0.9; integer TAIL; integer link_named(string n) { integer i = llGetNumberOfPrims(); for (; i > 1; --i) if (llGetLinkName(i) == n) return i; return 0; } splash() { llParticleSystem([PSYS_PART_FLAGS, PSYS_PART_INTERP_SCALE_MASK | PSYS_PART_INTERP_COLOR_MASK, PSYS_SRC_PATTERN, PSYS_SRC_PATTERN_ANGLE_CONE, PSYS_SRC_ANGLE_BEGIN, 0.0, PSYS_SRC_ANGLE_END, 0.5, PSYS_SRC_BURST_PART_COUNT, 16, PSYS_SRC_BURST_RATE, 0.05, PSYS_SRC_MAX_AGE, 0.15, PSYS_SRC_BURST_SPEED_MIN, 1.0, PSYS_SRC_BURST_SPEED_MAX, 1.8, PSYS_SRC_ACCEL, <0, 0, -4.0>, PSYS_PART_MAX_AGE, 0.7, PSYS_PART_START_SCALE, <0.05, 0.05, 0>, PSYS_PART_END_SCALE, <0.02, 0.02, 0>, PSYS_PART_START_COLOR, <0.8, 0.95, 1.0>, PSYS_PART_END_COLOR, <0.6, 0.85, 1.0>, PSYS_PART_START_ALPHA, 0.9, PSYS_PART_END_ALPHA, 0.0]); } place(vector p, rotation r) { llSetLinkPrimitiveParamsFast(LINK_ROOT, [PRIM_POSITION, p, PRIM_ROTATION, r]); } leap() { if (LEAPING) return; LEAPING = TRUE; T0 = llGetTime(); splash(); llSetTimerEvent(0.05); } default { state_entry() { TAIL = link_named("tail"); HOME = llGetPos(); if (TAIL) llSetLinkPrimitiveParamsFast(TAIL, [PRIM_POS_LOCAL, <-0.11, 0, 0>, PRIM_ROT_LOCAL, llEuler2Rot(<0, -PI_BY_TWO, 0>)]); llSetTimerEvent(20 + llFrand(40)); } on_rez(integer n) { llResetScript(); } touch_start(integer n) { leap(); } timer() { if (!LEAPING) { leap(); return; } float s = (llGetTime() - T0) / DUR; if (s >= 1) { LEAPING = FALSE; splash(); place(HOME, ZERO_ROTATION); llSetTimerEvent(20 + llFrand(40)); return; } // arc along local x of the pool: up, over, and down, nose following the curve vector p = HOME + <(s - 0.5) * SPAN, 0, 0.08 + H * 4 * s * (1 - s)>; float slope = H * 4 * (1 - 2 * s) / SPAN; place(p, llEuler2Rot(<0, -llAtan2(slope, 1), 0>)); if (TAIL) llSetLinkPrimitiveParamsFast(TAIL, [PRIM_ROT_LOCAL, llEuler2Rot(<0, -PI_BY_TWO, 0>) * llEuler2Rot(<0, 0, 0.5 * llSin(llGetTime() * 30)>)]); } }