Jump to content

KeyframedMotion do pushing avatar?


JointVenture1488303251
 Share

You are about to reply to a thread that has been inactive for 3356 days.

Please take a moment to consider if this thread is worth bumping.

Recommended Posts

It works fine for me.  Compare with ....

integer open=FALSE;float angle=PI_BY_TWO; // angle to turn [radians]float motion_time( float mt){    mt = llRound(45.0*mt)/45.0;    if ( mt > 0.11111111 ) return mt;    else return 0.11111111;}turn( float ang, float time){    list FrameList;    integer maxsteps=(integer)(motion_time(time) * 9);    float newtime = maxsteps / 9.0;    integer i ;    for  ( i = 0; i < maxsteps ; i++)    {        FrameList += [             llEuler2Rot(< ang/(float)maxsteps,0,0>),            newtime/(float)maxsteps        ];    }    llSetTimerEvent(newtime);       llSetKeyframedMotion(  FrameList, [KFM_DATA,KFM_ROTATION]);    if ( TRUE )  //Fake to force state change    {         state turning;    } }default{    state_entry()    {        llSitTarget(<0.0,0.0,1.0>,llEuler2Rot(<0.0,0.0,PI/2>));    }    changed(integer change)    {        if (change & CHANGED_LINK)        {            if (llAvatarOnSitTarget())            {                turn( angle, PI);            }        }    }}state turning{    timer()    {        state waitingTouch;    }}
state waitingTouch{ touch_end(integer t) { angle = - angle; turn( angle, PI); } }

 

Link to comment
Share on other sites

Hi,

that is strange. Please test this in any order:

  • rezz a Prim,
  • put in the script,
  • rezise the prim to 0.01 ,0.01, 0.01
  • change parameter to Sit on Object
float angle = 0.2; // (radians)float steps = 38.0; // > = langsamer (keyframes)vector Position = <-0.27, 0.00, 0.13>; // Avatar Positionvector Rotation = <0, 0, 90>;    // Avatar Rotation// << END edit// ------------------------------------float step = 0.0;list KFMlist = [];vector U;vector V;float angleU = 0.0;float angleV;integer swing = 1;vector basePos;rotation baseRot; integer LinkTarget = LINK_THIS;string Animation = "";key Avatar = "";integer Permission = FALSE;default{    state_entry()    {        llSetMemoryLimit( llGetUsedMemory()+0x1000);        if(llGetInventoryNumber(INVENTORY_ANIMATION) > 0 && Animation == "")  // Prueft ob eine Animation vorhanden ist.        {            Animation = llGetInventoryName(INVENTORY_ANIMATION, 0); // Speichert den Namen der eingelegten Animation.        }        //// Pendulum motion by Dora Gustafson, Studio Dora 2012        llSetPrimitiveParams([PRIM_PHYSICS_SHAPE_TYPE, PRIM_PHYSICS_SHAPE_CONVEX]);        basePos = llGetPos();        baseRot = llGetRot();        vector v1 = llGetScale();        float periode = TWO_PI*llSqrt( v1.z/9.81);        float dT = periode/steps;        dT = llRound(45.0*dT)/45.0;        if ( dT < 0.11111111 ) dT = 0.11111111;        v1.x = -0.25;        v1.y = 0.0;        v1 = 0.45*v1*llGetRot();        U = v1;        while ( step < steps )        {            step += 1.0;            angleV = angle*llCos( TWO_PI*step/steps + PI_BY_TWO);            V = v1*llAxisAngle2Rot(llRot2Left(llGetRot()), angleV);            KFMlist += [V-U, llEuler2Rot(< 0.0, angleV-angleU, 0.0>), dT];            angleU = angleV;            U = V;        }    }    run_time_permissions(integer Permission)    {        if(Permission & PERMISSION_TRIGGER_ANIMATION)        {            llStopAnimation("sit_generic");            llStopAnimation("sit");            llStartAnimation(Animation);        }    }     changed(integer change)    {        if (change & CHANGED_LINK)        {                        if ( swing == 1 )            {                //llVolumeDetect(TRUE);                Avatar = llGetLinkKey(2); //llAvatarOnLinkSitTarget(LinkTarget);                if (Avatar)                {                    llSetKeyframedMotion( KFMlist, [ KFM_MODE, KFM_LOOP]);                    if(Animation != "") // Wird nur ausgefuehrt, wenn bekannt.                    {                        llRequestPermissions(Avatar, PERMISSION_TRIGGER_ANIMATION);                    }                    swing = 0;                }            }            else if ( swing == 0 )            {                if(Permission) // Wenn die Permission abgefragt wurde.                {                    if(llKey2Name(Avatar) != "") // Prueft Avatar noch da ist.                    {                        llStopAnimation(Animation);                    }                    Permission = FALSE; // Loescht Perms.                }                Avatar = "";                swing = 1;                llSetKeyframedMotion( [], []);                llSetPrimitiveParams([PRIM_POSITION, basePos, PRIM_ROTATION, baseRot]);                //llVolumeDetect(FALSE);            }        }        if(change & (CHANGED_OWNER|CHANGED_REGION_START|CHANGED_INVENTORY))        {            llResetScript();        }    }    on_rez( integer n) { llResetScript(); }}

 

I've noticed, It is not a behavior of the mesh itself.

cheers

Link to comment
Share on other sites

You are about to reply to a thread that has been inactive for 3356 days.

Please take a moment to consider if this thread is worth bumping.

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
 Share

×
×
  • Create New...