Animesh
Posted: Thu Feb 20, 2020 6:34 am
Anyone have scripts for animesh?
Documentation, discussion and support for Kitely users
https://www.kitely.com/forums/
Code: Select all
////--------Shows/Hides mesh when animated....
float animation_speed = 0.5;
integer total_prims;
integer link_counter;
default
{ state_entry() { total_prims = llGetNumberOfPrims(); llSetTimerEvent(animation_speed ); } timer() { link_counter++; llSetLinkAlpha(LINK_SET, 0.0, ALL_SIDES); llSetLinkAlpha( link_counter,1.0, ALL_SIDES); if( link_counter == total_prims) { link_counter = 0; } }
}
//// -------- end of script --- copy up to here.
Thanks so much!Gusher Castaignede wrote: ↑Mon Feb 24, 2020 8:12 pm
Try this...
Code: Select all
////---------Script starts here ---- copy from here float animation_speed = 0.5; integer total_prims; integer link_counter; default { state_entry() { total_prims = llGetNumberOfPrims(); llSetTimerEvent(animation_speed ); } timer() { link_counter++; llSetLinkAlpha(LINK_SET, 0.0, ALL_SIDES); llSetLinkAlpha( link_counter,1.0, ALL_SIDES); if( link_counter == total_prims) { link_counter = 0; } } } //// -------- end of script --- copy up to here.
Code: Select all
default
{
state_entry()
{
llStartObjectAnimation("washhands");
}
}
Kimm Starr wrote: ↑Mon Feb 24, 2020 11:51 pmThanks so much!Gusher Castaignede wrote: ↑Mon Feb 24, 2020 8:12 pm
Try this...
Code: Select all
////---------Script starts here ---- copy from here float animation_speed = 0.5; integer total_prims; integer link_counter; default { state_entry() { total_prims = llGetNumberOfPrims(); llSetTimerEvent(animation_speed ); } timer() { link_counter++; llSetLinkAlpha(LINK_SET, 0.0, ALL_SIDES); llSetLinkAlpha( link_counter,1.0, ALL_SIDES); if( link_counter == total_prims) { link_counter = 0; } } } //// -------- end of script --- copy up to here.
Code: Select all
/////-----Use in a prim as a control device to click a prim/box to control animation or if you insist on using a mesh only approach then you must right click on the mesh and choose "touch".
integer running = 0;
string anim = "";
default
{
state_entry()
{
llOwnerSay("Touch to start the animation");
}
touch_start(integer total_number)
{
if(running == 1)
{
llStopObjectAnimation(anim);
llOwnerSay("Stopped " + anim);
running = 0;
}
else
{
anim = llGetInventoryName(INVENTORY_ANIMATION, 0);
llStartObjectAnimation(anim);
llOwnerSay("Started " + anim);
running = 1;
}
}
}
Code: Select all
//---Play Random Animations....
float randomized_time = 7.0; // experiment with this time
float animation_speed = 0.5;
integer total_prims;
integer link_counter;
action()
{
llSetLinkAlpha(LINK_SET, 0.0, ALL_SIDES);
llSetLinkAlpha( link_counter,1.0, ALL_SIDES);
}
default
{
state_entry()
{
total_prims = llGetNumberOfPrims();
state warmup;
}
}
state warmup
{
state_entry()
{
state trigger;
}
changed( integer c)
{
if ( c & CHANGED_LINK)
{
llResetScript();
}
}
}
state trigger
{
state_entry()
{
llSetTimerEvent(animation_speed);
}
timer()
{
link_counter++;
action();
if( link_counter == total_prims)
{
link_counter = 0;
state wait;
}
}
}
state wait
{
state_entry()
{
llSetTimerEvent(llFrand(randomized_time));
}
changed( integer c)
{
if ( c & CHANGED_LINK)
{
llResetScript();
}
}
timer()
{
state warmup;
}
}
Code: Select all
////----Root Prim number is 1 in a linkset. And 2 is the number of the first child prim if we link the prims sequentially . Initial value of the link_counter to 2. so that it will ignore number 1 ( which is the root prim) ;
float animation_speed = 0.25; // change as per your need
integer link_counter = 2; // 2 is the first childprim number in a linkset
integer total_prims;
set_alpha()
{
llSetLinkAlpha(LINK_SET, 0.0,-1);
llSetLinkAlpha( LINK_ROOT,1.0,-1);
llSetLinkAlpha( link_counter,1.0, -1);
}
default
{
state_entry()
{
total_prims = llGetNumberOfPrims();
llSetLinkAlpha(LINK_SET, 1.0,-1);
llSetTimerEvent(animation_speed );
state forward;
}
}
state forward
{
timer()
{
link_counter++;
set_alpha();
if( link_counter == total_prims)
{
state reverse;
}
}
}
state reverse
{
timer()
{
link_counter--;
set_alpha();
if( link_counter == 2)
{
state forward;
}
}
}
Gusher Castaignede wrote: ↑Sun Mar 08, 2020 5:40 pmHere's another three examples.....
SOURCE: https://youtu.be/0n_sgd_1920
/////-----Use in a prim as a control device to click a prim/box to control animation or if you insist on using a mesh only approach then you must right click on the mesh and choose "touch".
Gusher Castaignede wrote: ↑Sun Mar 08, 2020 7:29 pmWhen it refers to linkset they are animated meshes with multiple meshes versus one single binded mesh....
Code: Select all
integer CHAN;
integer BOTCHAN = 123;
integer MARKERMAX = 6;//total number of markers
integer gMarkCount = 0;
vector gTarget;
rotation gAngle;
rotation gRot;
rotation gRotOld;
float SPEED = 0.5; //smaller is faster
rotation f_rotDir(vector localAxisToPointWith, vector target, vector origin)
{
return llRotBetween(localAxisToPointWith*ZERO_ROTATION, target-origin);
}
SFrame(vector pos,rotation rot, float seconds)
{
//From Kayaker Magic
llSetKeyframedMotion([pos-llGetPos(),rot/llGetRot(),seconds],
[KFM_MODE,KFM_FORWARD,KFM_DATA,KFM_TRANSLATION|KFM_ROTATION]);
}
default
{
state_entry()
{
llSetRot(ZERO_ROTATION);
gRot = ZERO_ROTATION;
llSensor("marker"+(string)gMarkCount, "", PASSIVE, 40.0, PI);
llStartObjectAnimation("HF-male_walk");
CHAN = llListen(BOTCHAN, "", NULL_KEY, "");
}
timer()
{
if (llVecDist(llGetPos(), gTarget) < 1.0)//arrived
{
if (gMarkCount == MARKERMAX-1)
{
gMarkCount = 0;
}
else
{
gMarkCount++;
}
llSensor("marker"+(string)gMarkCount, "", PASSIVE, 40.0, PI);
}
}
sensor(integer total_number)
{
gTarget=llDetectedPos(0);
llSetTimerEvent(1.0);
gRot = llDetectedRot(0);
float distance = llVecDist(llGetPos(), llDetectedPos(0));
SFrame(llDetectedPos(0), gRot, distance*SPEED);
gRotOld = gRot;
}
no_sensor()
{
llDie();
}
listen(integer c, string name, key id, string msg)
{
if ((c == 123) && (msg == "die"))
{
llDie();
}
}
}