• 08Jul

    What I want to do:

    Bind the rotation channel of an object to a sinusoidal wave function for smooth, client-side swinging/rocking motion.

    Some cool stuff you could make with driven rotation:

    • A swinging hammock.
    • A rocking chair for granny.
    • A weeble that wobbles but never falls down.
    • A chintzy Felix the Cat clock with pendulum tail and moving eyes.
    • A Gothic church bell that swings convincingly.
    • A tree branch that seems to move in the breeze.
    • A boat that seems to gently rock and sway in the water.
    • A bird that flaps its wings convincingly.

    Other cool stuff you could do with generalized algorithm-driven attributes:

    • A prim that “breathes” in and out (slowly grows/shrinks).
    • A prim that moves in a circle, ellipse, figure-8, etc.
    • A torus that pulses and grows over time.
    • A carousel that goes ’round and ’round, while the horsies go up and down.
    • A flexi clump of seaweed that waves side-to-side hypnotically.
    • A glowstick that smoothly changes color in time to music.
    • A flower bud that slowly opens and becomes vivdly colored to greet the sun.

    Notes:

    • Motion is client-side only; collision detection won’t work in the expected way. This is already the case with rotation set on a nonphysical object using llTargetOmega.
    • Server-side bindings could exist in the future. They would be updated relatively infrequently (only a few times per second), while client-side interpolation keeps it looking smooth.

    Interface:

    llDriveAttribute( [attribute, algorithm, parameter1, ..., parameterN, ...] )

    This interface is future-proof: new attributes, algorithms, and parameters could be added later, without breaking existing content.
    Note that multiple parameter sets can be chained together for one function call, similar to llSetPrimParameters or llParticleSystem.

    Implementation notes:

    • Select from a set of pre-defined algorithms which take parameters for tweaking. Proposed initial set:
      • SIN_WAVE: Sinusoidal wave. Parameters: duration, amplitude, value offset, period, phase shift.
      • TRI_WAVE: Triangle wave. Parameters: ibid.
      • SAW_WAVE: Sawtooth wave. Parameters: ibid.
      • LINEAR: Constant change. Parameters: duration, slope, value offset
    • Regarding “duration” parameter: Motion stops after this many seconds. Can be non-integer (float). Can be FOREVER (-1.0). Can be STOP_NOW (0.0).
    • Parameters are sent to the client with the time that it started. This allows all viewers to remain in sync, even viewers who arrive after it has started. All algorithms are parametric (based on real-time); the algorithm can be evaluated at any point in time, without needing to evaluate earlier points in time to ‘catch up’.
    • A one-time synchronization between the sim clock and the client clock would be necessary to properly know how much to adjust the current time when evaluating the algorithms.

    Posted by Jacek Antonelli @ 7:54 pm

3 Responses

WP_Cloudy