Talk:LlSetKeyframedMotion

From Second Life Wiki
Revision as of 11:01, 8 September 2011 by Strife Onizuka (talk | contribs)
Jump to navigation Jump to search

Animation Types

Instead of setting integer Loop, let's reuse animation flags that was built for llSetTextureAnim function as list to combine flags usage.
LOOP REVERSE PING_PONG SMOOTH ROTATE SCALE and maybe add another flag POSITION(0x80)?


LOOP
Starts from the beginning to the end and returns back to the beginning to start again.
REVERSE
Played backward in following order of the list.
PING_PONG
Starts from the beginning to the end and play backward back to the beginning to start again.
SMOOTH
Could be used as another suggestion between sliding to the next target instead of "llSetPos"-like frames.
ROTATE, SCALE, and POSITION
Allow user to trim list down a bit without the needs to add all three at the same time. (Might be a wishful thinking though.)

Generally allow users to develop system that could have more than one LlSetKeyframedAnimation function call, long as it's not using same axis/scale/position again, which overrides the first of that same flag. One function call use position and second function call use rotation and scale for a type of event call.

I must point out a discussion about stopping, how do to about it. At the moment, suggesting use STOP(0x00) with combination of any flag from above? --Nacon-tag.jpg 03:07, 31 August 2011 (PDT)

These are great suggestions. I'd make a few tweaks, though:
  • Only LOOP, PING_PONG, and maybe REVERSE make sense here (SMOOTH is implicit in the way keyframing works--it is always a smooth interpolation)
  • ROTATE and TRANSLATE make sense and are a good way to reduce the size of the lists required. However, it would not be feasible to support multiple merging the keyframe sets from different calls (e.g., one call with ROTATE and one with TRANSLATE)
  • SCALE is not possibly to implement for physical objects in a way that ensures satisfactory performance. Modifying the scale of a physics shape requires (in simplified terms): (1) rebuilding the shape from scratch, (2) removing the object from the world, (3) applying the new shape to the object, and (4) adding the object back into the world. #1, 2, and 4 are all expensive operations.
To stop the animation, you could simply pass in an empty list of keyframes.
Falcon Linden 19:11, 6 September 2011 (PDT)
As to how to supply these to the function, how about [..., ANIM_FLAGS, integer flags, ...]. -- Strife (talk|contribs) 11:01, 8 September 2011 (PDT)

Interpolation

I've got a couple ideas for interpolation:

  1. Separate flags for configuring interpolation mode for position and orientation parameters. Defaults being LERP and SLERP respectively. Also some flags that provide smoother acceleration.
  2. Allow the user to instead of supplying a vector or a rotation parameter in the list to supply a float, which should be in the range [0, 1] indicating a proportional interrelated position/orientation between previous and future frames.
    • So [<0,0,0>, <0,0,0,1>, 0.0, 0.25, 0.0, 0.5, <4,0,0>, <0,0,0,1>, 1.0]
      • So by 0.5 seconds, the position is only <1,0,0> not, <2,0,0> and by 0.75 seconds it would be at <3,0,0>.
    • There is no real reason to restrict the user to the [0, 1] range, and the user may want to overshoot the end so they can mimic oscillating about the end point before reaching it (and having to calculate out the frames).

-- Strife (talk|contribs) 11:01, 8 September 2011 (PDT)