Jump to content

Catmull Rom or Bezier curves in game play animal movement


VirtualKitten
 Share

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

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

Recommended Posts

ok so if I understand  just need to call  if(TYPE == 😎 return coefisFirst() in vector nextCoordinates(integer TYPE) and use 8 to get the curves  what does  . My dragon has no poseball yet I am trying to figure out the adjacently move thing for particle ball. Its not so easy either.


vector Bez( float x ) { return P0 + (Q1 + (Q2 + Q3*x)*x)*x; }
 
vector dBez( float x ) { return Q1 + (2.0*Q2 + 3.0*Q3*x)*x; }
 
vector sBez( float x ) { return 2.0*Q2 + 6.0*Q3*x; }

 

do?

 

this one rotation ?
Vec2Rot( vector FWD )
{
    
    FWD = llVecNorm( FWD );
    vector UP = < 0.0, 0.0, 1.0 >;
    if ( llFabs(FWD.z) < 1.0 ) LEFT = llVecNorm(UP%FWD);
    UP = llVecNorm(FWD%LEFT);
    return refFrame*llAxes2Rot(FWD, LEFT, UP);
}

 

so infact are you suggesting I need 

vector nextpoint = coefisFirst() 

if(TYPE == 8 )return nextpoint   and yet new rotation Vec2Rot(nextpoint)?

Edited by VirtualKitten
8 became smiley face
Link to comment
Share on other sites

i went back to Doras ode and found this  what is the 

b2 = Bez( i/liN);

r2 = Vec2Rot(dBez( i/liN)); in a for frame loop for  is b2 = Bez( i/liN);

r2 = Vec2Rot(dBez( i/liN)); used to calculate the location of the point to move to ?

So I am guessing is Bez( i/liN); my new position and Vec2Rot(dBez( i/liN)) my new rotation 

 

If i dont use i in a loop will this impact the first curve

 Doras snipit 
               KFMlist=[];
                coefisFirst();
                b1 = Bez(0);
                r1 = Vec2Rot( dBez(0));
                integer i;
                for ( i=1; i<=frames; i++ )
                {
                    b2 = Bez( i/liN); r2 = Vec2Rot(dBez( i/liN));
                    KFMlist += [ b2-b1, r2/r1, dT];
                    b1 = b2; r1 = r2;
                }

 

Am I really looking at a timer event to pack a list of moves  that I call from as this seems over memory use  using an array 

Edited by VirtualKitten
Link to comment
Share on other sites

Here is a one-shot bezier curve generator that outputs region position and rotations adapted from Dora's code. I have removed all the second and third parts, the dialogs, the particles, the movement, and the generation of times and deltas, and all code not required to generate and output the curves, this should make it easier for you to study the method of generating the curves.

 

// One-shot Bezier curve generation to give region positions and rotations
// within a 10m x 10m x 0m space centred around the containing prim
// Adapted from the following work:
// Bezier Key Framed Motion script by Dora Gustafson, Studio Dora 2012
// Build on Cubic(3.order) Bezier chain by Dora Gustafson, Studio Dora 2008

 
vector range = < 5.0, 5.0, 0.0 >;  // ± half range for each coordinate in meters
rotation refFrame=<-0.5, -0.5, -0.5, 0.5>; // points Z forward

integer frames=16;
vector P0;
vector P1;
vector P2;
vector P3;
vector Q1;
vector Q2;
vector Q3;
vector LEFT=< 0.0, 1.0, 0.0 >;
list PosRotList=[];
vector b1;
vector b2;
rotation r1;
rotation r2;
integer curvNumb=3;

rotation homeRot;

integer listLen;
integer lastList;
 
vector randomP()
{
    return llGetPos() + < range.x*(llFrand( 2.0)-1.0), range.y*(llFrand( 2.0)-1.0), range.z*(llFrand( 2.0)-1.0) > * homeRot;
}
 
rotation Vec2Rot( vector FWD )
{
    FWD = llVecNorm( FWD );
    vector UP = < 0.0, 0.0, 1.0 >;
    if ( llFabs(FWD.z) < 1.0 ) LEFT = llVecNorm(UP%FWD);
    UP = llVecNorm(FWD%LEFT);
    return refFrame*llAxes2Rot(FWD, LEFT, UP);
}
  
coefisFirst()
{
    P0 = llGetPos();
    P3 = randomP();
    P2 = randomP();
    P1 = randomP();
    Q1 = 3.0*P1-3.0*P0;
    Q2 = 3.0*P0-6.0*P1+3.0*P2;
    Q3 = 3.0*P1-P0+P3-3.0*P2;
}
 
vector Bez( float x ) { return P0 + (Q1 + (Q2 + Q3*x)*x)*x; }
 
vector dBez( float x ) { return Q1 + (2.0*Q2 + 3.0*Q3*x)*x; }
 
 
string operation = "";
 
default
{
    state_entry()
    {
        refFrame.s = -refFrame.s;
    }
    touch_end(integer n)
    {
        if ( llDetectedKey(0) == llGetOwner() )
        {
            if (operation == "" )
            {
                homeRot = llGetRot();
                float liN = (float)frames;
                PosRotList=[];
                lastList=0;
                coefisFirst();
                b1 = Bez(0);
                r1 = Vec2Rot( dBez(0));
                integer i;
                for ( i=1; i<=frames; i++ )
                {
                    b2 = Bez( i/liN); r2 = Vec2Rot(dBez( i/liN));
                    PosRotList += [b2, r2]; //  [ b2-b1, r2/r1, dT];
                    b1 = b2; r1 = r2;
                }
                listLen = llGetListLength(PosRotList);
                operation = "New";
                llOwnerSay("Touch me to see the list of points");
            }
             else if( operation == "New")
            {
                //llOwnerSay("List is " + llDumpList2String(PosRotList, ","));
                integer ii;
                integer iiMax = llGetListLength(PosRotList);
                for(ii = 0; ii <iiMax; ii+=2)
                {
                    llOwnerSay("Point " + (string) ((integer) (ii * 0.5)) + " At " + llList2String(PosRotList, ii) + " Rot " + llList2String(PosRotList, ii+1) );
                }
                operation = "";
            }
        }
    }
    on_rez(integer param) { llResetScript(); }
}

 

 

Edited by Profaitchikenz Haiku
  • Like 1
Link to comment
Share on other sites

so would i just use in my get Next Position (9)

 

     if(TYPE == 9) {
         if (b_i == liN || b_i == 0) {b_i = 0; coefisFirst();}
         return Bez( b_i/liN); 
         b_i++;
     } 

So I have if i am right and understand you nextCoordinates(9) will call this over until LiN frames or points and then start a new curve

vector nextCoordinates(integer TYPE) {
    float driftRange = llFrand(MOVEMENT_RANGE);
    float circle_radius = 5.0;
    float a = llFrand(TWO_PI);
    float b = llFrand(TWO_PI);
    float c = llFrand(PI);
   
   // if(TYPE == 2) return <iPos.x + driftRange, iPos.y + llFrand(MOVEMENT_RANGE), iPos.z>;
    //if(TYPE == 4) return <iPos.x + driftRange * llCos(a), iPos.y + driftRange * llSin(b), iPos.z>;
  //  if(TYPE == 8) return iPos + <driftRange * llCos(a) * llCos(b), driftRange * llCos(a) * llSin(b), driftRange * llSin(a)>;
    if(TYPE == 9) {
         if (b_i == liN || b_i == 0) {b_i = 0; coefisFirst();}
         return Bez( b_i/liN); 
         b_i++;
     }  

    return iPos;
}

Now this more or less spins my dragon like other 2,4,8 did  I can only guess my region detection or the box range is wrong see video?

https://i.gyazo.com/123d8cee8fe8401da3995b820fa0ffc6.mp4

I have the following code  and vector WANDER_RANGE = <20.0,20.0,5.0>;:

integer  checkInside2(vector bottomLeftCorner, vector topRightBack, vector pos) 
{
    if (topRightBack == ZERO_VECTOR ||
    bottomLeftCorner == ZERO_VECTOR ||
    pos.x < bottomLeftCorner.x ||
        pos.y < bottomLeftCorner.y ||
        pos.x > topRightBack.x ||
        pos.y > topRightBack.y ||
        pos.z > topRightBack.z )  {
            return FALSE; // If weare outside area
    }
    return TRUE;
}
vector clipRegion(vector bot, vector top, vector pos)
{
    if (pos.x < bot.x) pos.x = bot.x;
    else if (pos.x > top.x) pos.x = top.x;
    if (pos.y < bot.y) pos.y = bot.y;
    else if (pos.y > top.y) pos.y = top.y;
    if (pos.z < bot.z) pos.z = bot.z;
    else if (pos.z > top.z) pos.z = top.z;
    return pos;
}
_llWanderWithinKeyframe (vector home,  vector range, list c) {
    pos = llGetPos();
    iPos = llGetPos();
    rotation newrot = llGetRot();
    list TYPE = [2,4,8,9] ; // ,16,32,64,128,126];
  
   
    integer vAreaParcelsqm = llList2Integer(llGetParcelDetails(iPos,[PARCEL_DETAILS_AREA]),0);
    vector area = < vAreaParcelsqm -.5, vAreaParcelsqm -.5,vAreaParcelsqm -.5>;
    vector bot = my_home-WANDER_RANGE  /2;
    vector top = my_home+WANDER_RANGE/2;
   // llInstantMessage(llGetOwner(),"bot:"+(string)bot+"top:"+(string)top);
    if(TYPE_COUNT++ > 1) { TYPE_COUNT = 0; TYPE_FLIGHT = (integer)(llFrand(7.0)); iPos = llGetPos();} 
    if( TYPE_FLIGHT == 0) {TYPE_FLIGHT  == 8; iPos = llGetPos();}
    
    integer i = 20;
    timer_wander = llGetUnixTime();
    do {
        i--;
        Debug("_llWanderWithinKeyframe:Process point");
        nex_pos = clipRegion(bot,top,nextCoordinates(llList2Integer(TYPE,TYPE_FLIGHT) )); 
    }  while(checkInside2(bot,top,nex_pos) == FALSE && i>0);
      
    if(nex_pos != ZERO_VECTOR && i!=0) {
         Debug("_llWanderWithinKeyframe: Moving : "+ (string)nex_pos); 
         if(TYPE_FLIGHT != 9) newrot = llGetRot(); else newrot =Vec2Rot(nex_pos); 
         target_wander_id = __loadCoordinates(iPos,(vector)(nex_pos-iPos),newrot, llFrand(FUDGE)+ (nex_pos.z)/SPEED,target_wander_id);
        
    }
}
      
      
      

 

 

Edited by VirtualKitten
Link to comment
Share on other sites

Thinking ahead t the point where you have learned to crawl, got up off the floor and are starting to walk, I have seen a showstopper to the whole idea of using KFM to get around. It will only work on a dead-flat surface, because KFM will not only move your dragon to NewX and NewY, but it will want to move it to NewZ as well, and NewZ might be under the level of the physics surface at NewX and NewY, and I can't see an easy way to get the hieght at that position.

I think you're going to have to go back to using methods that propel the Dragon in an X and Y combination of directions but rely on the underlying physics surface taking care of it's elevation...

Edited by Profaitchikenz Haiku
Link to comment
Share on other sites

Well I comented out my checks for inside Region and Check in Range and it did same thing so it must be the nextposition or wander code doing this  code still doing this. I have nothing in this to trap the case the bezier is  moves out of range 

 

vector nextCoordinates(integer TYPE) {
    // float driftRange = llFrand(MOVEMENT_RANGE);
    // float circle_radius = 5.0;
    // float a = llFrand(TWO_PI);
    // float b = llFrand(TWO_PI);
    // float c = llFrand(PI);
   
    // if(TYPE == 2) return <iPos.x + driftRange, iPos.y + llFrand(MOVEMENT_RANGE), iPos.z>;
    //if(TYPE == 4) return <iPos.x + driftRange * llCos(a), iPos.y + driftRange * llSin(b), iPos.z>;
    //  if(TYPE == 8) return iPos + <driftRange * llCos(a) * llCos(b), driftRange * llCos(a) * llSin(b), driftRange * llSin(a)>;
    if(TYPE == 9) {
         if (b_i == liN || b_i == 0) {b_i = 0; coefisFirst();}
         iPos = Bez( b_i/liN); 
         b_i++;
     }  

    return iPos;
}

 

Edited by VirtualKitten
Link to comment
Share on other sites

You are aware that the function coefisFirst() simply sets up the initial start conditions for a set of Beziers but nothing else?

  Belay that, I got lost in a profusion of commented-out code

 

What Dora is doing is using the range value as limits when ever any of the three random points for the bezier curves are generated, so it's done first of all, P0 i the starting point (assumed to be inside the range), then P1, P2, and P3 are generated randomly, and ussed by subsequent calculations. You are not doing this and so some points are going to be generated outside the range.

Edited by Profaitchikenz Haiku
  • Haha 1
Link to comment
Share on other sites

6 minutes ago, VirtualKitten said:

I dont understand why i need to use dbez surely Vec2Rot( Bez( b_i/liN))  will wok?

Yes, it might, but I dont see that statement in your code snippet either. I see you calling vec2Rot(nex_Pos) but is that the same? If Bez was adequate why would Dora have used dBez instead?

Edited by Profaitchikenz Haiku
Link to comment
Share on other sites

I tried it

vector nextCoordinates(integer TYPE) {
  
   Debug("nextCoordinates");

    if(TYPE == 9) {
         if (b_i == liN || b_i == 0) b_i = 0;
         coefisFirst();
         iPos = Bez( b_i/liN); 
         newrot = Vec2Rot(dBez( b_i/liN));
         b_i++;
     }  

    return iPos;
}

_llWanderWithinKeyframe (vector home,  vector range, list c) {
    pos = llGetPos();
    iPos = llGetPos();
    
    list TYPE = [9] ; // ,16,32,64,128,126];
    integer vAreaParcelsqm = llList2Integer(llGetParcelDetails(iPos,[PARCEL_DETAILS_AREA]),0);
    vector area = < vAreaParcelsqm -.25, vAreaParcelsqm -.25,vAreaParcelsqm -.25>;
    vector bot = my_home-WANDER_RANGE  /2.0;
    vector top = my_home+WANDER_RANGE/2.0;
    //llInstantMessage(llGetOwner(),"bot:"+(string)bot+"top:"+(string)top);
 //   if(TYPE_COUNT++ > 1) { TYPE_COUNT = 0; TYPE_FLIGHT = (integer)(llFrand(7.0)); iPos = llGetPos();} 
   TYPE_FLIGHT=9;
   if( TYPE_FLIGHT == 0) {TYPE_FLIGHT  == 8; iPos = llGetPos();}
    integer i = 20;
    timer_wander = llGetUnixTime();
    do {
        i--;
        Debug("_llWanderWithinKeyframe:Process point");
        nex_pos = clipRegion(bot,top,nextCoordinates(llList2Integer(TYPE,TYPE_FLIGHT) )); 
    }  while(checkInside2(bot,top,nex_pos) == FALSE && i>0);
      
    if(nex_pos != ZERO_VECTOR && i!=0) {
         Debug("_llWanderWithinKeyframe: Moving : "+ (string)nex_pos); 
         if(TYPE_FLIGHT != 9)  newrot = llGetRot();
         target_wander_id = __loadCoordinates(iPos,(vector)(nex_pos-iPos),newrot, llFrand(FUDGE)+ (nex_pos.z)/SPEED,target_wander_id);
        
    }
}

And it was the same no movement it could be lsl having connection problem i will try tomorrow, hugs x

 

Link to comment
Share on other sites

25 minutes ago, VirtualKitten said:
target_wander_id = __loadCoordinates(iPos,(vector)(nex_pos-iPos),newrot, llFrand(FUDGE)+ (nex_pos.z)/SPEED,target_wander_id);

I would suggest you comment this out and instead set a test prim to nex_pos and newrot to debug your position generation, and once happy with that, go back to trying to get the wandering to work. There's far too much going on in there that could account for no movement or no rotation. Work on one thing at a time.

Link to comment
Share on other sites

Hmm , Prof it wont progress, if I do that as the target is required to move on and if not set will stop movement but I have simplified liN to 5 as it was 10 . There was no change  I presume you would like a printout of the points it creates to look at I can do that:

 

integer __loadCoordinates(vector l_pos ,vector l_dest,rotation l_rot, float time , integer target) 
{
            //Debug("Load Points...");
           llInstantMessage(llGetOwner(),"lpos:"+(string)l_pos+", lDest:"+(string)l_dest);

etc

As you can see ZERO_VECTOR is given as destination which explains why its not moving:
[03:42] Dragontest: lpos:<230.52710, 25.94859, 3518.70200>, lDest:<0.00000, 0.00000, 0.00000>

However , If I place a message here :
 

vector nextCoordinates(integer TYPE) {
   
    if(TYPE == 9) {
         if (b_i == liN || b_i == 0) b_i = 0;
         coefisFirst();
         iPos = Bez( b_i/liN); 
         newrot = Vec2Rot(dBez( b_i/liN));
         b_i++;
     }  
    llInstantMessage(llGetOwner(),"ipos:"+(string)iPos);
    return iPos;
}

I get a constant destination value  output which is odd :
[03:47] Dragontest: ipos:<230.52710, 25.94859, 3518.70200>

[03:48] Dragontest: ipos:<230.52710, 25.94859, 3518.70200>

I also noted TYPE was empty 0 and was being reset by my advance reset  sorted this and have produced a moving dump :
[04:04] Dragontest: ipos:<230.50340, 25.66232, 3518.71200>, newrot:<0.47281, -0.52578, -0.01529, 0.70694>, TYPE:9
[04:04] Dragontest: ipos:<230.47460, 25.69403, 3518.71400>, newrot:<0.57893, -0.40600, 0.70709, 0.00461>, TYPE:9
[04:04] Dragontest: ipos:<230.52010, 25.82897, 3518.70700>, newrot:<-0.70623, 0.03526, -0.69990, -0.10066>, TYPE:9
[04:04] Dragontest: ipos:<231.10010, 25.53748, 3518.66200>, newrot:<-0.61493, 0.34909, -0.68689, 0.16786>, TYPE:9
[04:04] Dragontest: ipos:<230.74100, 25.41944, 3518.69300>, newrot:<-0.25539, -0.65937, -0.60373, 0.36812>, TYPE:9
[04:04] Dragontest: ipos:<230.80220, 24.74232, 3518.70000>, newrot:<0.22823, -0.66926, 0.58474, 0.39759>, TYPE:9
[04:04] Dragontest: ipos:<230.50130, 25.66157, 3518.71000>, newrot:<0.23445, -0.66711, 0.47901, 0.52015>, TYPE:9
[04:04] Dragontest: ipos:<230.49720, 25.65967, 3518.71000>, newrot:<-0.10895, -0.69866, 0.05848, 0.70468>, TYPE:9
[04:04] Dragontest: ipos:<230.47790, 25.63909, 3518.71000>, newrot:<-0.59678, -0.37928, -0.20163, 0.67775>, TYPE:9
[04:04] Dragontest: ipos:<230.48640, 25.54206, 3518.71000>, newrot:<-0.69550, -0.12758, -0.58007, 0.40438>, TYPE:9
[04:04] Dragontest: ipos:<230.93620, 25.53039, 3518.67100>, newrot:<0.54637, -0.44887, 0.16243, 0.68820>, TYPE:9
[04:04] Dragontest: ipos:<230.99770, 25.60481, 3518.66500>, newrot:<-0.69232, 0.14386, -0.67253, -0.21841>, TYPE:9
[04:04] Dragontest: ipos:<230.76730, 25.42241, 3518.68700>, newrot:<-0.26934, -0.65380, -0.07498, 0.70312>, TYPE:9
[04:04] Dragontest: ipos:<230.85560, 24.68674, 3518.69300>, newrot:<0.61351, -0.35157, 0.68005, 0.19373>, TYPE:9
[04:04] Dragontest: ipos:<230.49330, 25.65669, 3518.70700>, newrot:<-0.70486, 0.05635, -0.61196, 0.35427>, TYPE:9
[04:04] Dragontest: ipos:<230.47620, 25.63115, 3518.70800>, newrot:<-0.62165, 0.33697, -0.55264, 0.44112>, TYPE:9

 

As you can see its pretty haphazard motion I have also noted when I am seated or linked it does not move the object oddly but it moves strangely no bezier  route when i am not 

https://i.gyazo.com/75ed0ccd20bd781c88e128ad338f3d8a.mp4

Edited by VirtualKitten
Added Data
Link to comment
Share on other sites

I can only repeat my advice, simplify your script, address one issue at a time. First of all get it working to output posittions and rotations forgetting about wandering, different type flights, etc. You are trying to debug oo many things all at once and risk getting bogged down in a serbonial swamp.

 

I suspect you won't take that advice and will press on, but if it helps you, let me just consider this routine:

42 minutes ago, VirtualKitten said:
if(TYPE == 9) {
         if (b_i == liN || b_i == 0) b_i = 0;
         coefisFirst();
         iPos = Bez( b_i/liN); 
         newrot = Vec2Rot(dBez( b_i/liN));
         b_i++;

If b_i == LiN or 0 you set b_i to 0, but then you call coefisFirst regardless, so if b_i was 3 or 4, instead of continuing from the last point, you are once again going back to the first point conditions.

Link to comment
Share on other sites

Prof, I am trying to learn and take your advice, please don't be cross   b_i is initialized at 0  is that not correct as i don't understand these Bezier curves . I understand you mean setting 0 will return to original position that would be ok for test . But my model  doesn't do that as it slides to the right of its range https://i.gyazo.com/25589190520a33a0e938b846646f43f4.mp4 and then cant produce points inside range. 

Edited by VirtualKitten
Link to comment
Share on other sites

If and only if you are starting a new curve, you set b_i to 0 AND call coefisFirst to generate the values for P1,P2,P3 q1, Q2,q3, but  subsequent iterations to use the P1,,,Q3 values first produced at the start of the curve. What you need is to enclose the b_i = 0 and coefisFirst() in braces

What I am trying to point out to you is that when you are trying to do too many things at once it isn't only yourself that is going to be struggling in the serbonial sough, but those trying to make sense of your code snippets.

It would help both of us if you scrapped all the TYPE stuff and only added it back once you have got the basic curve-generation working.

Edited by Profaitchikenz Haiku
Link to comment
Share on other sites

oh I see so ,hugs, its not required to keep calling it i didn't understand that tks I will give it a go ad come back with results :D

The TYPE stuff is to add more functionality later as I was using that to control my bat with out bezier curves 

 

 

Changed where liN is 5  b_i starts at 0 

vector nextCoordinates(integer p_TYPE) {

   Debug("nextCoordinates");
    if(p_TYPE == 9) {
         if (b_i == liN || b_i == 0) { b_i = 0;  coefisFirst();}
         iPos = Bez( b_i/liN); 
         newrot = Vec2Rot(dBez( b_i/liN));
         b_i++;
     }  
   llInstantMessage(llGetOwner(),"ipos:"+(string)iPos+", newrot:"+(string)newrot+", TYPE:" +(string)p_TYPE);
    return iPos;
}

Here is the results it just spun on the spot but goes up and down a little  Here is the dump right from the code its generated from which seems to follow how its moving my model:

[05:57] Dragontest: ipos:<228.09280, 27.50462, 3515.72700>, newrot:<-0.36692, -0.60446, 0.20377, 0.67711>, TYPE:9
[05:57] Dragontest: ipos:<228.09280, 27.50462, 3515.72700>, newrot:<-0.36692, -0.60446, 0.20377, 0.67711>, TYPE:9
[05:57] Dragontest: ipos:<228.09280, 27.50462, 3515.72700>, newrot:<-0.36692, -0.60446, 0.20377, 0.67711>, TYPE:9
[05:57] Dragontest: ipos:<228.09280, 27.50462, 3515.72700>, newrot:<-0.36692, -0.60446, 0.20377, 0.67711>, TYPE:9
[05:57] Dragontest: ipos:<228.09300, 27.50420, 3515.72300>, newrot:<0.56870, -0.42021, 0.44150, 0.55234>, TYPE:9
[05:57] Dragontest: ipos:<228.09300, 27.50420, 3515.72300>, newrot:<0.56870, -0.42021, 0.44150, 0.55234>, TYPE:9
[05:57] Dragontest: ipos:<228.09300, 27.50420, 3515.72300>, newrot:<0.56870, -0.42021, 0.44150, 0.55234>, TYPE:9
[05:57] Dragontest: ipos:<228.09300, 27.50420, 3515.72300>, newrot:<0.56870, -0.42021, 0.44150, 0.55234>, TYPE:9
[05:57] Dragontest: ipos:<228.09300, 27.50420, 3515.72300>, newrot:<0.56870, -0.42021, 0.44150, 0.55234>, TYPE:9
[05:57] Dragontest: ipos:<228.09280, 27.50390, 3515.72600>, newrot:<-0.12924, -0.69520, 0.68290, 0.18343>, TYPE:9
[05:57] Dragontest: ipos:<228.09280, 27.50390, 3515.72600>, newrot:<-0.12924, -0.69520, 0.68290, 0.18343>, TYPE:9
[05:57] Dragontest: ipos:<228.09280, 27.50390, 3515.72600>, newrot:<-0.12924, -0.69520, 0.68290, 0.18343>, TYPE:9
[05:57] Dragontest: ipos:<228.09280, 27.50390, 3515.72600>, newrot:<-0.12924, -0.69520, 0.68290, 0.18343>, TYPE:9

Yes, Prof there is a lot of other code that does stuff abt 900 lines but anything with movements comes through these routines that i have shared. 

Hugs

Edited by VirtualKitten
Link to comment
Share on other sites

1 hour ago, VirtualKitten said:

Yes, Prof there is a lot of other code that does stuff abt 900 lines but anything with movements comes through these routines that i have shared. 

This cries out to be added to the list of famous last words :)

Try putting the initial starting conditions such as range into the one-shot script I posted, stick it in the same location, and see if it gives results that are an order of magnitude different.

Because of the random numbers the test harness and your code will never give the same exactly, but you can be clever here and in your code, get the coefisFirst to print out the values for P1, P2, P3, Q1, q2, Q3, and then in the test harness, don't generate random values for those six variables but instead make direct assignments using the siz values you got fro your routine. This will allow you to debug where your routines are diverging.

Link to comment
Share on other sites

21 hours ago, Profaitchikenz Haiku said:
vector range = < 5.0, 5.0, 0.0 >;  // ± half range for each coordinate in meters

Right at the top of the test harness script. It is used each time a random point is generated :

 

21 hours ago, Profaitchikenz Haiku said:
vector randomP()
{
    return llGetPos() + < range.x*(llFrand( 2.0)-1.0), range.y*(llFrand( 2.0)-1.0), range.z*(llFrand( 2.0)-1.0) > * homeRot;
}

I'm wondering if you are suffering from the same problem I was for a while, the font in the script editor floater is a bit smaller than I would like it to be. I got around that by trying to wear two pairs of glasses, on over the other, but now my nose is a bit sore.

Can I make a last plea for you to put aside your dragon script and play around with the one-shot bezier script I posted? It will allow you to explore every aspect of how the positions and rotations are generated inside of a bounding cube,, and once you understand that, you can then start copy.pasting bits of it back into your Dragon script?

Link to comment
Share on other sites

Prof omg yes I didn't notice this at all or homerot  does this need setting too

vector WANDER_RANGE = <20.0,20.0,10.0>;

I changed  

vector randomP()
{
    return llGetPos() + < WANDER_RANGE.x*(llFrand( 2.0)-1.0), WANDER_RANGE.y*(llFrand( 2.0)-1.0), WANDER_RANGE.z*(llFrand( 2.0)-1.0) > * homeRot;
}

which is a little better but still spins about from report :

[08:11] Dragontest:<237.63450, 22.97095, 3510.29200>, newrot:<0.57888, -0.40607, 0.62622, 0.32841>, TYPE:9
[08:11] Dragontest:<237.83490, 22.55526, 3510.28100>, newrot:<-0.25646, -0.65896, 0.08918, 0.70146>, TYPE:9
[08:11] Dragontest:<237.83490, 22.55526, 3510.28100>, newrot:<-0.25646, -0.65896, 0.08918, 0.70146>, TYPE:9
[08:11] Dragontest:<237.83490, 22.55526, 3510.28100>, newrot:<-0.25646, -0.65896, 0.08918, 0.70146>, TYPE:9
[08:11] Dragontest:<237.83490, 22.55526, 3510.28100>, newrot:<-0.25646, -0.65896, 0.08918, 0.70146>, TYPE:9
[08:11] Dragontest:<237.83490, 22.55526, 3510.28100>, newrot:<-0.25646, -0.65896, 0.08918, 0.70146>, TYPE:9
[08:11] Dragontest:<238.47110, 23.02396, 3510.22000>, newrot:<0.36167, -0.60762, -0.10060, 0.69991>, TYPE:9
[08:11] Dragontest:<238.47110, 23.02396, 3510.22000>, newrot:<0.36167, -0.60762, -0.10060, 0.69991>, TYPE:9
[08:11] Dragontest:<238.47110, 23.02396, 3510.22000>, newrot:<0.36167, -0.60762, -0.10060, 0.69991>, TYPE:9
[08:11] Dragontest:<238.47110, 23.02396, 3510.22000>, newrot:<0.36167, -0.60762, -0.10060, 0.69991>, TYPE:9
[08:11] Dragontest:<238.47110, 23.02396, 3510.22000>, newrot:<0.36167, -0.60762, -0.10060, 0.69991>, TYPE:9
[08:11] Dragontest:<237.75390, 22.48861, 3510.29000>, newrot:<0.29117, -0.64438, 0.43022, 0.56117>, TYPE:9
[08:11] Dragontest:<237.75390, 22.48861, 3510.29000>, newrot:<0.29117, -0.64438, 0.43022, 0.56117>, TYPE:9

 

hugs Dx

Link to comment
Share on other sites

You are about to reply to a thread that has been inactive for 842 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...