Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Detect if someone is sitting on an object

Sarah85 Oh
Registered User
Join date: 4 Feb 2007
Posts: 9
02-05-2007 14:52
Is there a way to detect if someone is sitting on an object? Also is it possible to get the location of the avatar that is sitting on it?
Jacques Groshomme
Registered User
Join date: 16 Mar 2005
Posts: 355
02-05-2007 14:57
In the object itself, you can call llAvatarOnSitTarget(). It will return the avatar's key if seated, otherwise NULL if not.
Sarah85 Oh
Registered User
Join date: 4 Feb 2007
Posts: 9
02-05-2007 15:01
Thank you shall try it now!
Newgate Ludd
Out of Chesse Error
Join date: 8 Apr 2005
Posts: 2,103
02-05-2007 15:16
You will also get a changed event when an AV sits on the prim or stands up

CODE

changed(integer change)
{
// The object's sit target has been triggered
if (change & CHANGED_LINK) // Test for a changed link
{
key avatar = llAvatarOnSitTarget();
if(avatar != NULL_KEY) // Is that changed link an avatar?
{
}
else // Stood up
{
}
}
}
Cid Jacobs
Theoretical Meteorologist
Join date: 18 Jul 2004
Posts: 4,304
02-05-2007 16:44
llGetAgentInfo
_____________________