Jump to content

targetrot,my seeming bain


MishkaKatyusha
 Share

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

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

Recommended Posts

welp,first an introduction of sorts.

ive been going from one place to the other on the web for the past 15 years.i love computer stuff.I do 3d graphics,story writing,animations,video animations,sound editing,music,and the list goes on.

 

and i also love code,im not terribly good at programming mind you,but i know how to alter things when needed,and have a thorough grounding in logic,also algebra.

 

bit of a problem though.now im on here.ive created a bed which is essentially two linked hemispheares (one for the bed part,the other acting as a sort of pillow).ive bought a script and some animations to go with it.being very mindful to only pick the resellable ones (since that is my intention)

but the one thing which has befuddled me so far is "targetrot".ive already worked out quite easily how vector target works,that was easy.

but targetrot does not seem to follow at all the logical algebraic representation of axis of movement.the best i can tell each set of numbers in targetrot is some kind of nonsensical looping,spiraling path.

i know that it has something to do with the object itself.

whats bad is though,the object movement and rotation is just fine,represented with algebraic axis standard.

but since obviously targetrot isnt,this leads to a massive mismatch where it isnt at all clear what those numbers will do when you alter them.

so my question boils down to: how to use targetrot to make sure my sleeping on side script and the animation has my character sleeping on her side on my bed.

 

(im also wondering,is it possibly a bad animation which is messing up things?)

Link to comment
Share on other sites

welp,lemme show you my problem

following is the code,with the problem highlighted in bold,and a screenshot showing what that does.this bed is two linked hemispheares



 

// Dhyana Writer 2009integer broadcast = 20;// Left Side Sleeping Position//vector target = <-1.06585, 0.71774, 0.18293>;//rotation targetRot = <0.50028, -0.49972, -0.50028, 0.49972>;// A More relaxed sleeping positionvector target = <-0.900, 0.36328, -0.23000>;rotation targetRot = <0.00001, -0.53456, -0.06875, 0.51038>;integer debugRotation = FALSE;key sitAgent = NULL_KEY;integer gotPermission = FALSE;integer time = 0;default{    state_entry()    {        llSetSitText( "Sleep" );        llSitTarget( target, targetRot );        if ( debugRotation ) {            llListen( 1977, "Rotation Broadcaster", NULL_KEY, "" );            llListen( 1978, "Rotation Broadcaster", NULL_KEY, "" );        }    }    listen(integer channel, string name, key id, string message ) {        if ( channel == 1977 )            targetRot = (rotation) message;        else            target = (vector) message;                    llSitTarget( target, targetRot );         if ( time == 0 )            llSay(0, (string) targetRot + ", " + (string)target );        time = (time +1) % 50;    }    changed(integer change) {        if (change & CHANGED_LINK)        {            key agent = llAvatarOnSitTarget();            if ( sitAgent == NULL_KEY && agent != NULL_KEY ) {                // Someone new sitting down                sitAgent = agent;                llRequestPermissions(sitAgent,PERMISSION_TRIGGER_ANIMATION);            }            else if ( sitAgent != NULL_KEY && agent == NULL_KEY) {                // sitting down person got up - wake up                 if ( gotPermission )                    llStopAnimation("sleep");                // Reset the script because we don't have a way of releasing permissions                 llResetScript();            }        }            }    run_time_permissions(integer parm) {        if(parm == PERMISSION_TRIGGER_ANIMATION) {            gotPermission = TRUE;            llStartAnimation("sleep pose 6");        }    }    }
Link to comment
Share on other sites

ahem,this is very nice.as far as i can deduce your attempting to tell me how to convert those quaternion mathmatics into algebraic coordinates.

but im afraid i didnt entirely understand what you said.as i explained inthe first post,im not terribly good with the scripting (or was it the second post?)

 

which part of my sleep script do i put this in >.> and how to do so without getting a syntax error,that requires abit more experience in lsl than a first timer(ish) can manage)

Link to comment
Share on other sites

// Dhyana Writer 2009

integer broadcast = 20;

 

// Left Side Sleeping Position

//vector target = <-1.06585, 0.71774, 0.18293>;

//rotation targetRot = <0.50028, -0.49972, -0.50028, 0.49972>;

// A More relaxed sleeping position

vector target = <-0.900, 0.36328, -0.23000>;

rotation targetRot;

integer debugRotation = FALSE;

key sitAgent = NULL_KEY;

integer gotPermission = FALSE;

 

integer time = 0;

default

{

state_entry()

{

rotation targetRot = llEuler2Rot(<0,0,30>*DEG_TO_RAD);//in z,y,z axis

llSetSitText( "Sleep" );

llSitTarget( target, targetRot );

if ( debugRotation ) {

llListen( 1977, "Rotation Broadcaster", NULL_KEY, "" );

llListen( 1978, "Rotation Broadcaster", NULL_KEY, "" );

}

}

listen(integer channel, string name, key id, string message ) {

if ( channel == 1977 )

targetRot = (rotation) message;

else

target = (vector) message;

 

llSitTarget( target, targetRot );

if ( time == 0 )

llSay(0, (string) targetRot + ", " + (string)target );

time = (time +1) % 50;

}

changed(integer change) {

if (change & CHANGED_LINK)

{

key agent = llAvatarOnSitTarget();

if ( sitAgent == NULL_KEY && agent != NULL_KEY ) {

// Someone new sitting down

sitAgent = agent;

llRequestPermissions(sitAgent,PERMISSION_TRIGGER_ANIMATION);

}

else if ( sitAgent != NULL_KEY && agent == NULL_KEY) {

// sitting down person got up - wake up Smiley Happy

if ( gotPermission )

llStopAnimation("sleep");

// Reset the script because we don't have a way of releasing permissions Smiley Happy

llResetScript();

}

}

}

run_time_permissions(integer parm) {

if(parm == PERMISSION_TRIGGER_ANIMATION) {

gotPermission = TRUE;

llStartAnimation("sleep pose 6");

}

}

 

}

Link to comment
Share on other sites

// Dhyana Writer 2009

 

// Left Side Sleeping Position

//vector target = <-1.06585, 0.71774, 0.18293>;

//rotation targetRot = <0.50028, -0.49972, -0.50028, 0.49972>;

// A More relaxed sleeping position

vector target = <-0.900, 0.36328, -0.23000>;

vector rotSet = <90.0, 90.0, 10.0>;

key sitAgent = NULL_KEY;

integer gotPermission = FALSE;

 

default

{

state_entry()

{

rotation targetRot = llEuler2Rot(rotSet*DEG_TO_RAD);//in x,y,z axis

llSetSitText( "Sleep" );

llSitTarget( target, targetRot );

}

changed(integer change)

{

if (change & CHANGED_LINK)

{

key agent = llAvatarOnSitTarget();

if ( sitAgent == NULL_KEY && agent != NULL_KEY )

{

// Someone new sitting down

sitAgent = agent;

llRequestPermissions(sitAgent,PERMISSION_TRIGGER_ANIMATION);

}

else if ( sitAgent != NULL_KEY && agent == NULL_KEY)

{

// sitting down person got up - wake up Smiley Happy

if ( gotPermission )

{

llStopAnimation("sleep pose 6");

llResetScript();

}

}

}

}

run_time_permissions(integer parm)

{

if(parm == PERMISSION_TRIGGER_ANIMATION)

{

gotPermission = TRUE;

llStartAnimation("sleep pose 6");

}

}

 

}

Link to comment
Share on other sites

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