Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Dynamic Seating

Jaydin Normandy
Registered User
Join date: 1 Apr 2006
Posts: 19
02-09-2009 09:43
How do you place multiple pose balls on a bench so that multiple avatars can sit on a same object at once?
Pedro McMillan
SLOODLE Developer
Join date: 28 Jul 2007
Posts: 231
02-09-2009 10:38
Each pose ball has a script inside it, which sets a "sit target" for it, sit targets are per prim (not per object). You need to link together multiple pose balls into a single objects, and then (as far as I understand it) when an avatar attempts to sit on it, SL will just look for the first available sit target in any of the prims.
Laurence Corleone
Registered User
Join date: 12 Oct 2006
Posts: 126
02-09-2009 17:25
I can't remember where I picked up this script but it pretty much does what you want. One person sits and it places them in position A. A second person sits and it puts them in position B. Person at position A stands up and person at position B slides over to take their place.

CODE

float seat;
float startseat;
integer startlinks;
integer links;
vector size;
float offset=0.75; //how far to space each seater

default
{
state_entry()
{
startlinks=llGetNumberOfPrims();
links=startlinks;
size=llGetScale();
seat=(size.y / 2) - 0.5;
startseat=seat;
llSitTarget(<0,size.y / 2,0.5>,ZERO_ROTATION);
}

changed(integer change)
{
if(change & CHANGED_LINK)
{
integer linksnow=llGetNumberOfPrims();
if(linksnow > links)
{
llSetLinkPrimitiveParams( llGetNumberOfPrims(), [ PRIM_POSITION, <0.5,seat,1> ]);
seat -= offset;
links=linksnow;
}
else
{
links=linksnow;
seat=startseat;
integer seated=links - startlinks;
if(seated)
{
integer i=1;
do
{
llSetLinkPrimitiveParams( startlinks + i, [ PRIM_POSITION, <0.5,seat,1> ]);
seat -= offset;
i++;
} while(i<=seated);
}
}
}
}
}
_____________________
There are no stupid questions, just stupid people.
Yingzi Xue
Registered User
Join date: 11 Jun 2008
Posts: 144
02-10-2009 03:18
Thanks for the offset script. This should work great for one prim, but... if you're using multiple "cushions" in your bench or making typical seating, here's how I do it.

You don't need a pose ball to make seating work. Simply put a pose script in each seat cushion. I use Sit Target Helper by Lex Neva, which allows you to adjust a sit position and then generate a script. If you want a demonstration or help, or need a copy let me know in-world. Remove the sit targets from prims you don't want to have a sit target (arm rests, back cushions, etc) by setting llSitTarget(ZERO_VECTOR,ZERO_ROTATION);. Link together the prims and the seat will function like you want, picking the next available sit target automatically.