Difference between revisions of "LlSetKeyframedMotion"

From Second Life Wiki
Jump to navigation Jump to search
m (moved LlSetKeyframedAnimation to LlSetKeyframedMotion: Changed name of LSL function to reduce confusion)
(Updating to reflect new API)
Line 1: Line 1:
{{LSL_Function
{{LSL_Function
|func=llSetKeyframedAnimation
|func=llSetKeyframedMotion
|inject-1={{LSL_Generic/proposal|text=It has not yet been scheduled for development.}}
|func_id=?
|func_id=?
|func_desc=Specify a list of times, positions, and orientations to be followed by an object. The object will be smoothly moved between keyframes by the simulator. Collisions with other nonphysical or keyframed objects will be ignored (no script events will fire and collision processing will not occur). Collisions with physical objects will be computed and reported, but the keyframed object will be unaffected by those collisions. (The physical object will be affected, however.)
|func_desc=Specify a list of times, positions, and orientations to be followed by an object. The object will be smoothly moved between keyframes by the simulator. Collisions with other nonphysical or keyframed objects will be ignored (no script events will fire and collision processing will not occur). Collisions with physical objects will be computed and reported, but the keyframed object will be unaffected by those collisions. (The physical object will be affected, however.)
Line 10: Line 9:
|p1_type=list|p1_name=keyframes|p1_hover=Strided keyframe list of the form: [vector position, rotation orientation, float time]
|p1_type=list|p1_name=keyframes|p1_hover=Strided keyframe list of the form: [vector position, rotation orientation, float time]
|p1_desc=Strided keyframe list of the form:
|p1_desc=Strided keyframe list of the form:
* ''vector'' position (optional via KFA_TRANSLATION and KFA_DATA)
* ''vector'' position (optional via KFM_TRANSLATION and KFM_DATA)
* ''rotation'' orientation (optional via KFA_ROTATION and KFA_DATA)
* ''rotation'' orientation (optional via KFM_ROTATION and KFM_DATA)
* ''float'' time
* ''float'' time


Line 23: Line 22:
|spec=
|spec=
The following flags will be supported within the ''options'' list:
The following flags will be supported within the ''options'' list:
*KFA_MODE followed by one of: KFA_LOOP, KFA_REVERSE, KFA_FORWARD, or KFA_PING_PONG will specify the playback mode. Defaults to KFA_FORWARD. Must be specified when the keyframe list is provided.
*KFM_MODE followed by one of: KFM_LOOP, KFM_REVERSE, KFM_FORWARD, or KFM_PING_PONG will specify the playback mode. Defaults to KFM_FORWARD. Must be specified when the keyframe list is provided.
*KFA_DATA followed by a bitwise combination of: KFA_TRANSLATION and KFA_ROTATION. By default both rotations and translations must be provided. If you specify one or the other, you should only include translations or rotations in your keyframe list. Must be specified at the time the keyframe list is provided.
*KFM_DATA followed by a bitwise combination of: KFM_TRANSLATION and KFM_ROTATION. By default both rotations and translations must be provided. If you specify one or the other, you should only include translations or rotations in your keyframe list. Must be specified at the time the keyframe list is provided.
*KFA_COMMAND followed by one of: KFA_CMD_STOP, KFA_CMD_PLAY, KFA_CMD_PAUSE, KFA_CMD_MODE. STOP will pause the animation AND reset it to the beginning. PAUSE will pause the animation without resetting. PLAY will resume a paused or stopped animation.  
*KFM_COMMAND followed by one of: KFM_CMD_STOP, KFM_CMD_PLAY, KFM_CMD_PAUSE, KFM_CMD_MODE. STOP will pause the animation AND reset it to the beginning. PAUSE will pause the animation without resetting. PLAY will resume a paused or stopped animation.  
**KFA_CMD_MODE should be followed by one of the KFA_MODE options above and can be used to modify the playback format. The animation must be in a stopped or paused state to use this parameter.
**KFM_CMD_MODE should be followed by one of the KFM_MODE options above and can be used to modify the playback format. The animation must be in a stopped or paused state to use this parameter.
Note that if a KFA_COMMAND is provided in the options list, it must be the first option and only one may be used per call.
Note that if a KFM_COMMAND is provided in the options list, it must be the first option and only one may be used per call.


Inter-region animations may be supported depending on development complexity.
Inter-region animations may be supported depending on development complexity.
Line 38: Line 37:


|examples=
|examples=
<code>llSetKeyframedAnimation([<0,0,10>, 5, <0,0,-10>, 5], [KFA_DATA, KFA_TRANSLATION, KFA_MODE, KFA_PING_PONG]);</code>
<code>llSetKeyframedMotion([<0,0,10>, 5, <0,0,-10>, 5], [KFM_DATA, KFM_TRANSLATION, KFM_MODE, KFM_PING_PONG]);</code>
<code>llSetKeyframedAnimation([<0,0,10>, llEuler2Rot(<90, 45, 180> * DEG_TO_RAD), 5, <0,0,-10>, llEuler2Rot(<270, 225, 360> * DEG_TO_RAD), 5], [KFA_MODE, KFA_REVERSE]);</code>
<code>llSetKeyframedMotion([<0,0,10>, llEuler2Rot(<90, 45, 180> * DEG_TO_RAD), 5, <0,0,-10>, llEuler2Rot(<270, 225, 360> * DEG_TO_RAD), 5], [KFM_MODE, KFM_REVERSE]);</code>
|notes=
|notes=
Potential Use Cases:
Potential Use Cases:

Revision as of 20:12, 5 October 2011

Summary

Function: llSetKeyframedMotion( list keyframes, list options );

Specify a list of times, positions, and orientations to be followed by an object. The object will be smoothly moved between keyframes by the simulator. Collisions with other nonphysical or keyframed objects will be ignored (no script events will fire and collision processing will not occur). Collisions with physical objects will be computed and reported, but the keyframed object will be unaffected by those collisions. (The physical object will be affected, however.)

• list keyframes Strided keyframe list of the form:
  • vector position (optional via KFM_TRANSLATION and KFM_DATA)
  • rotation orientation (optional via KFM_ROTATION and KFM_DATA)
  • float time

Each keyframe is interpreted relative to the previous transform of the object. For example, consider the following list of keyframes: [<0, 0, 10>, ZERO_ROTATION, 5, <0, 0, 0>, ZERO_ROTATION, 5, <0, 0, -10>, ZERO_ROTATION, 5]. This would cause the object to move up 10m over the course of 5s. It would then remain at the location for 5s before moving down 10m over the course of another 5s. Time values must be greater than 0.1s. Linear and angular velocities will be clamped to limits set by the simulator (values TBD). An empty list will terminate any keyframed animation currently playing.

• list options modifiers and future options

Specification

The following flags will be supported within the options list:

  • KFM_MODE followed by one of: KFM_LOOP, KFM_REVERSE, KFM_FORWARD, or KFM_PING_PONG will specify the playback mode. Defaults to KFM_FORWARD. Must be specified when the keyframe list is provided.
  • KFM_DATA followed by a bitwise combination of: KFM_TRANSLATION and KFM_ROTATION. By default both rotations and translations must be provided. If you specify one or the other, you should only include translations or rotations in your keyframe list. Must be specified at the time the keyframe list is provided.
  • KFM_COMMAND followed by one of: KFM_CMD_STOP, KFM_CMD_PLAY, KFM_CMD_PAUSE, KFM_CMD_MODE. STOP will pause the animation AND reset it to the beginning. PAUSE will pause the animation without resetting. PLAY will resume a paused or stopped animation.
    • KFM_CMD_MODE should be followed by one of the KFM_MODE options above and can be used to modify the playback format. The animation must be in a stopped or paused state to use this parameter.

Note that if a KFM_COMMAND is provided in the options list, it must be the first option and only one may be used per call.

Inter-region animations may be supported depending on development complexity.

Caveats

  • This function can only be called on NON-physical objects. In the future it could be extended to support physical objects, but this is more complicated as collisions could prevent the object from reaching its goal positions on time.
  • This function can only be called on the root prim of a linkset.
  • This function requires the linkset to use the Prim Equivalency system. However, it keyframed objects will not receive the dynamics penalty and can have a physics PE of up to 64.
  • There are a few bugs in the avatar animation system that may cause strange looking animations to play when standing on a moving platform (e.g., walking in place, feet-at-pelvis). We hope to fix these in the future, but doing so is out of scope for this feature.
All Issues ~ Search JIRA for related Bugs

Examples

llSetKeyframedMotion([<0,0,10>, 5, <0,0,-10>, 5], [KFM_DATA, KFM_TRANSLATION, KFM_MODE, KFM_PING_PONG]);

llSetKeyframedMotion([<0,0,10>, llEuler2Rot(<90, 45, 180> * DEG_TO_RAD), 5, <0,0,-10>, llEuler2Rot(<270, 225, 360> * DEG_TO_RAD), 5], [KFM_MODE, KFM_REVERSE]);

Notes

Potential Use Cases:

  • Elevators
  • Moving platforms
  • Trains/Fixed-Track Vehicles
  • Moving doors/walls/gates
  • Windmills and other machines

Deep Notes

Search JIRA for related Issues

Signature

function void llSetKeyframedMotion( list keyframes, list options );