Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Sit offset for the 100th time

Boreal Latte
Registered User
Join date: 15 Nov 2007
Posts: 104
03-07-2008 06:01
Hi all. As many have experienced, sitting on odd shaped objects are a pain, so I thought I would automate setting up the offset. Here is my plan. I want to sit on object T using animation A. I make a ball B loaded with animation A. I then sit on B, and move B into position over T so that it looks right.
Then I ask the two to sync.
That is, B tells T its location and rotation using a say command using script S1
In response to that, T need to set its llSitTarget using script S2.

Based on the position of T and B, I am able to get the first param for llSitTarget as
(pos(B)-pos(T))/rot(T), and the second param as (rot(B)/rot(T))

This works "reasonable well", but I am some 30cm off, consistently, independent of the shape of T and B. As B is turned I am off in different directions, but never more than these approx 30 cm.
This is the listen part from script S2.

listen( integer channel, string name, key id, string message )
{
vector targetPos = (vector)llList2String(info,0);
rotation targetRot = (rotation)llList2String(info,1);
list myInfo = llGetObjectDetails(llGetKey(),[OBJECT_POS,OBJECT_ROT]);
vector myPos = llList2Vector(myInfo,0);
rotation myRot = llList2Rot(myInfo,1);
vector toTarget = targetPos-myPos;
llSitTarget(toTarget/myRot,targetRot/myRot);
}

What did I overlook?
Straif Ash
Registered User
Join date: 14 Jan 2006
Posts: 57
03-07-2008 07:39
I've been thinking of doing something very similar to this. I don't have an answer for you, but I'll be watching this thread.

In the few pieces of furniture I've made, I've always put the pose animations in the furniture itself (usually a cushion since that seems to be appropriate). Doing it by hand has always been a lot of trial and error--mostly error. I dislike poseballs. They have their use; when it isn't intuitive that you can sit on an object, or for, um, gender-specific actions. Otherwise, I think they are distracting and a waste of a perfectly good prim. Invisible poseballs still waste a prim, but at least aren't ugly on an otherwise perfectly good chair.

I would love for an easy way (especially one that isn't tied to a particular pose manufacturer's scripts) to position a poseball or poseplywoodcube, then translate those settings to a item itself.
Brandi Lane
Registered User
Join date: 2 Apr 2007
Posts: 157
03-07-2008 08:08
Unless I miss my guess, this is already done and it works very nicely. The scripts for this are in the script library.