Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Sit sometimes comes out crooked

Tigerlily Hyun
Registered User
Join date: 20 Mar 2007
Posts: 12
03-17-2009 05:45
Strange but maybe simple question. Newbie scriptor here, so bare with me. I'm using a simple open source pose script in object with an added custom animation. I've set the SitTarget up properly for the position on the object. Everything looks normal when I sit most of the time, but every once in a while when I sit, I'm crooked... like rotated 45 degrees either left or right. If I stand and sit again (sometimes a couples times) it seems to fix it. Can you see something wrong in the script? Any ideas or help would be greatly appreciated!!! Thanks in advance!



string DISPLAY_TEXT = "Object";

string ANIMATION;
integer is_sitting;

default
{
state_entry()
{
ANIMATION = llGetInventoryName(INVENTORY_ANIMATION, 0);
is_sitting = 0;
llSitTarget(<-.6,0,-.4>,llEuler2Rot(<0,270,0> * DEG_TO_RAD));
llSetText(DISPLAY_TEXT,<1,1,1>,1);
}

changed(integer change)
{
if(change & CHANGED_LINK)
{
key av = llAvatarOnSitTarget();

if(av != NULL_KEY)
{
llRequestPermissions(av, PERMISSION_TRIGGER_ANIMATION);
}
else
{
if((llGetPermissions() & PERMISSION_TRIGGER_ANIMATION) && is_sitting)
{
is_sitting = 0;
llStopAnimation(ANIMATION);
llSetText(DISPLAY_TEXT,<1,1,1>,1);
}
}

}
ANIMATION = llGetInventoryName(INVENTORY_ANIMATION, 0);
}

run_time_permissions(integer perm)
{
if(perm & PERMISSION_TRIGGER_ANIMATION)
{
is_sitting = 1;
llStopAnimation("sit_generic";);
llStopAnimation("sit";);
llStartAnimation(ANIMATION);
llSetText("",<1,1,1>,1);
}
}

on_rez(integer start_param)
{
llResetScript();
}
}
Dora Gustafson
Registered User
Join date: 13 Mar 2007
Posts: 779
03-17-2009 06:55
I do not see anything wrong with the script and I tested it in world, I see no malfunction.
Did you try it in different regions? It may be a local phenomenon in space or time;)
_____________________
From Studio Dora
Rolig Loon
Not as dumb as I look
Join date: 22 Mar 2007
Posts: 2,482
03-17-2009 09:40
Maybe totally unrelated, but just yesterday I had to replace a bench from my sim because its sit poses had suddenly gone wonky -- sitting 45 degrees from the regular positons. I can't explain it. No other sit poses that I tested had gone bad, and the replacement bench behaved itself properly. Magic is loose in the world?
Tigerlily Hyun
Registered User
Join date: 20 Mar 2007
Posts: 12
03-17-2009 10:21
Perhaps... maybe I'll try reuploading the animation and rebuilding the prim from scratch. Might just be one of those SL things! Thanks, good to know it's not just me!
Kayaker Magic
low carbonated footprint
Join date: 11 Sep 2008
Posts: 109
03-20-2009 21:06
I've had some reliability issues with stopping and starting animations that were all resolved by inserting a call to
llSleep(0.1);
After every call to llStopAnimation() or llStartAnimation() Give this a try and see if your script becomes more reliable. It is as if these calls sometimes take a little asynchronus time to get started.