07-11-2006 10:35
I propose a new type of client-side rotation which follows a waveform pattern, causing the object to smoothly oscillate back-and-forth on an arbitrary axis. This rotation would be comparable to the rotation achieved with the llTargetOmega function, in that it would be smooth rotation performed client-side, on non-physical objects, without any need for constant updates from the server.

Potential Applications

Such a rotation has many potential applications. I will list a few here, but I am sure that Second Life's users are capable of thinking up hundreds of others:
  1. Swinging pendulums, such as in grandfather clocks.
  2. Rocking chairs, porch swings, and hammocks.
  3. See-saws, tire swings, rocking horses, and other playground equipment and amusement park attractions.
  4. Grasses and other foliage waving in the wind.
  5. Birds, fish, and other animals flapping wings, swimming, etc.

All of these things can be attempted at the present time by modifying the rotation of the object server-side, but this requires a fairly complex script, continuously uses server resources, and yields an undesirably choppy motion.

Requirements

This type of rotation can be easily modelled as a sinusoidal wave. In order to be useful in a variety of situations, the user must have control over a number of characteristics of the wave, namely:
  1. Amplitude: peak deviation from the center value (in radians).
  2. Center: middle value around which the wave oscillates (in radians).
  3. Period: time elapsed during a complete cycle of the wave (in seconds).
  4. Phase Shift: time displacement of the beginning of the wave cycle (in seconds).

I will note that an alternative to specifying period directly would be to specify frequency, the inverse of period. However, because one can be easily converted into the other, this issue is only a question of style.

Script Interface

With the above requirements in mind, a possible function prototype suggests itself:

void llOscillate( vector axis, float amplitude, float center, float period, float phaseshift )

Here, axis is the axis of rotation. The rest of the arguments correspond to the wave properties described above.

The proper name for the function is a matter for discussion. I suggest llOscillate because it is short, descriptive, and unambiguous.

Comments/Feedback

Thoughtful comments, feedback, and discussion are encouraged within this thread.

I will provide a link to the Feature Voting entry for this proposal soon.

Edit: This proposal is Prop #1615 on the Feature Voting system.