Jump to content

Avatar Link Location to llSitTarget Formula


Bloodsong Termagant
 Share

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

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

Recommended Posts

okay so...

 

i have nPose, and i have AVsitter (version 2 and version 1), and i have SitTargetHelper....   but all i want to do is write a SIMPLE script that takes ONE avatar sitting on ONE thing, moves it around, and can save that as a new sit target.

 

now, i can get the seated avatar's link position and rotation no problem.  and i can change those and scoot it around.   and i have scripts and functions that can get an ACCURATE sit target from the avatar seated on a TOTALLY SEPARATE prim/object... but i haven't found any that can get it from the avatar actually linked TO it.  and im bad at math in general, but when you start mathing vectors and rotations and quaternions and radians... OMG! 

 

as for avsitter... it apparently doesn't even use llSitTarget at all, but grabs the avatar and sticks it in position based on stored settings.  (and as for npose, my eyes were so bleary from peering at avsit code, i just couldn't... :X )

 

does anybody know this forumula?  if it's not proprietary to you, can you tell me what it is?  if it IS proprietary, how much you selling it for?

 

Link to comment
Share on other sites

5 hours ago, Bloodsong Termagant said:

as for avsitter... it apparently doesn't even use llSitTarget at all, but grabs the avatar and sticks it in position based on stored settings.  (and as for npose, my eyes were so bleary from peering at avsit code, i just couldn't... :X )

Yes.  That's how both AvSitter and nPose work.    The avatar sits on the object and then the script moves the av into position, using llSetLinkPrimitiveParamsFast.   A sit target has to be set, so the script can identify llAvatarOn(Link)SitTarget, but it doesn't really matter what it's set as, since as soon as you sit, the script takes over and uses the notecard settings.

 

Edited by Innula Zenovka
Link to comment
Share on other sites

if you mean a helper prim to move the avatar when sitting and be able to get avatar pos and rotation as a copypasta llSitTarget to paste into a runtime sit script.  A example of a sit helper goes something like:

 

// simple sit target animation pose helper

// make a skinny helper prim: 0.1 x 0.1 x 2.0
// link it to your seat
// put this script and the sit animation into the root prim of your seat
// sit on the seat
// Edit the seat (check Edit Linked)
// Edit-select the skinny helper prim and move/rotate it
// Your avatar will move/follow the skinny helper
// Press the Print button om the dialog menu
//    it will print/say in chat the position and rotation of your avatar
//    as a llSitTarget() statement
// Copypasta the statement into your runtime seat sit script
// Can copypasta the statement into state_entry of this script also as a default for the helper 
 

list sit_target;
string sit_anim;
integer listen_hnd;

default
{
    state_entry()
    {
        //llSitTarget(<0.0, 0.0, 0.4>, ZERO_ROTATION);
        llSitTarget(<0.774521, -0.069794, 0.755936>,<0.000000, 0.000000, 0.000000, 1.000000>);
    }
    
    changed(integer change)
    {
        if (change & CHANGED_LINK)
        { 
            if (llAvatarOnSitTarget() != NULL_KEY) // avatar got on 
                llRequestPermissions(llAvatarOnSitTarget(), PERMISSION_TRIGGER_ANIMATION);
            else // avatar got off
            {
                llSetTimerEvent(0.0);
                llListenRemove(listen_hnd);
                if (sit_anim != "")
                    llStopAnimation(sit_anim);
            }    
        }
    }
    
    run_time_permissions(integer perms)
    {
        if (perms & PERMISSION_TRIGGER_ANIMATION)
        {        
            listen_hnd = llListen(-8102, "", llAvatarOnSitTarget(), "Print");
            sit_anim = llGetInventoryName(INVENTORY_ANIMATION, 0);
            if (sit_anim != "")
                llStartAnimation(sit_anim);
            llSetTimerEvent(1.0);
            llDialog(llAvatarOnSitTarget(), "Print - sit target to chat", ["Print"], -8102); 
        }
    }

    listen(integer channel, string name, key id, string text)
    {
        llRegionSayTo(id, 0, "llSitTarget(" + llDumpList2String(sit_target, ",") + ");");
        llDialog(id, "Print - sit target to chat", ["Print"], -8102);
    }
        
    timer()
    {
        sit_target = llGetLinkPrimitiveParams(llGetNumberOfPrims()-1, [PRIM_POS_LOCAL, PRIM_ROT_LOCAL]);
        llSetLinkPrimitiveParamsFast(llGetNumberOfPrims(), [PRIM_POS_LOCAL, llList2Vector(sit_target, 0), PRIM_ROT_LOCAL,  llList2Rot(sit_target, 1)]);
    }
    

}

 

 

 

 

Link to comment
Share on other sites

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