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:
- Swinging pendulums, such as in grandfather clocks.
- Rocking chairs, porch swings, and hammocks.
- See-saws, tire swings, rocking horses, and other playground equipment and amusement park attractions.
- Grasses and other foliage waving in the wind.
- 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:
- Amplitude: peak deviation from the center value (in radians).
- Center: middle value around which the wave oscillates (in radians).
- Period: time elapsed during a complete cycle of the wave (in seconds).
- 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.