Join us in Outworldz at www.outworldz.com:9000 or follow us:

Search dozens of selected web sites for OpenSim and LSL script

New! Script Meta-Search will search thousands of scripts here and at other sites for LSL or Opensim scripts.
Loading

Want to add a script or a project? Upload it and a half million people will see it and your name here this year.

Home   Show All
Category: Contributor: Creator
Positioning KeyFrame_Animator_Script  

KeyFrame_Animator_Script

A simple yet useful script for recording and playing back prim movement.

To use this, put the script into a prim or a set of prims, type "Init", move the entire prim linkset, and type " set". Repeat. When done type "Run".

You may want to remove or edit the line in the Run section where it does a llSetPrimitiveParams so you can re-position the prim somewhere, as all prim movements are relative to the the current position.

Commands are typed in Chat:

Init - resets the script and gets it ready
set - records a position and rotation
Run - Plays back the animation
Export - Prints the list to chat so you can save it or put it into another script.

Category: Positioning
By : Jasper Flossberg
Created: 2013-05-13 Edited: 2013-05-13
Worlds: Second Life

the Zip file

Download all files for KeyFrame_Animator_Script
Contents are in zip format, with .LSL (text) source code and LSLEdit (text + Solution) formats.
Get file # 1. KeyFrame_Animator_Script_1.lsl
1 // This work uses content from the Second Life® Wiki article at http://wiki.secondlife.com/wiki/User:Jasper_Flossberg. Copyright © 2007-2012 Linden Research, Inc. Licensed under the Creative Commons Attribution-Share Alike 3.0 License.
2 // Attribution — You must attribute the work
3 // Share Alike — If you alter, transform, or build upon this work, you may distribute the resulting work only under the same or similar license to this one.
4
5 integer channel=0;
6 integer MODE=0; // 0 NonInit 1 Init 2 Run
7 list keys=[];
8 vector last_pos;
9 rotation last_rot;
10
11 vector start_pos;
12 rotation start_rot;
13
14 update_loc()
15 {
16 last_pos=llGetPos();
17 last_rot=llGetRot();
18 }
19
20 default
21 {
23 {
24 llSay(0, "Welcome to the KeyFrame Setter v1.0 by Jasper Flossberg");
25 llListen(0,"",NULL_KEY,"");
26 }
27
28 touch_start(integer total_number)
29 {
30 channel=(integer)llFrand(4000000);
31 llDialog(llDetectedKey(0),"Please choose option",["Init","Run","Export"],channel);
32 llListen(channel,"",NULL_KEY,"");
33 }
34 listen(integer channel, string name, key id, string message)
35 {
36 if(message=="Init")
37 {
38 llSay(0,"Intializing KeyFrame Setter");
39 llSetKeyframedMotion([],[]);
40 keys=[];
41 update_loc();
42 start_pos=llGetPos();
43 start_rot=llGetRot();
44 MODE=1;
45
46 }
47 if(llGetSubString(message,0,2)=="set")
48 {
49 if(MODE==1)
50 {
51 string time=llList2String(llParseString2List(message,[" "],[]),1);
52 llSay(0,"Setting new KeyFrame with "+time);
53 keys+=[llGetPos()-last_pos,ZERO_ROTATION*(llGetRot()/last_rot),(integer)time];
54 update_loc();
55 }
56
57 }
58 if(message=="Run")
59 {
60 MODE=2;
62 llSetKeyframedMotion(keys,[KFM_MODE,KFM_LOOP]);
63 }
64 if(message=="Export")
65 {
66 llSay(0,(string)keys);
67 }
68 }
69 }

Back to the Best Free Tools in Second Life and OpenSim.