Thus began my llSitTarget() adventures.
First I hit the scripting wiki. I decide to use the basic built-in sit so that I don't have to bother with permission-to-animate.
Every prim has a "sit target" that I can adjust with a script. Looks easy enough.
llSitTarget(, llEuler2Rot(
So I whip up a new script and drop it into the base prim. I spend some time adjusting the numbers so that I'm not sitting with my shapely behind in the air. Then I drop out of the editor, and click to sit. And my rump is in the air again. WTF?
Again, every prim has a sit target. So when I clicked on a prim other than the base one, it chose the sit target of that prim. *smacks head* Okay, so how do I get rid of the sit targets on the other prims in my chair? Or do I have to set ALL of them?
The only way to clear the sit target is by calling llSitTarget(ZERO_VECTOR,ZERO_ROTATION); Ah! Good, I can get rid of all these unwanted sit targets. With that in mind, if I want a sit target I cannot use all zeros for position and rotation. I've gotten some odd results from this - if the object is big enough, something else determines an appropriate spot to sit? Not sure yet.
default // How to make a prim with no sit target.
{
state_entry()
{
llSitTarget(ZERO_VECTOR,ZERO_ROTATION);
}
}
But the multi prim chairs I've seen don't have a script in every prim. So what am I missing? If a script gives a prim a sit target, and that script is deleted, the sit target remains. Okay, it is a property of the prim, like those HoverText scripts you always see in gift boxes. Drop in a copy of the "NoSit" script, then delete it from the prim. Keep your rear end off the arms of my chair!
But, um... what'll happen if someone tries to sit on my chair and clicks on a prim without a sit target? Will they end up using the base prim's sit target or ???
If the primitive the player clicked on has no sit target, and one or more other linked objects have sit targets that are not full, the sit target of the object with the lowest link number will be used. So it will run thru the prims it is linked to until it finds one with a sit target. That works for me. Useful for benches and stuff with more than one "seat" as well.
Speaking of benches... I have this two prim bench at home... Time to teleport back to my home parcel and edit the bench. Each prim gets a sit target, one on either side of the seat. Great! I click on the base prim and as expected I sit in the "first" seat. Then I click on the other prim and I sit in the "second" seat... because If the primitive the player clicked on has a sit target and that sit target is not full, that sit target is used. Time to sit down and enjoy the view!
EDIT: More here.
No comments:
Post a Comment