Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

problem with standing up

BamBam Sachertorte
floral engineer
Join date: 12 Jul 2005
Posts: 228
09-11-2005 22:56
I'm building a structure about 40m in the air and I want to let people sit on the edge. But when they stand up they always jump forward and fall 40m to the ground. So I would like the avatar to jump up and backwards, back onto the platform. I tried this script:
CODE
    key sitter = NULL_KEY;

changed(integer change) { // something changed
if (change & CHANGED_LINK) { // and it was a link change
key avsit = llAvatarOnSitTarget();
if (avsit != NULL_KEY) { // somebody is sitting on me
llSay(0, "Hello " + llKey2Name(avsit) + ", have a seat.");
} else if (sitter != NULL_KEY) {
llSay(0, "Goodbye " + llKey2Name(sitter) + ".");
llPushObject(sitter, <100, 0, 100>, ZERO_VECTOR, FALSE);
}
sitter = avsit;
}
}
It seemed to notice avatars sitting and standing up but the llPushObject() did not have the desired affect. What am I missing?
Jesrad Seraph
Nonsense
Join date: 11 Dec 2004
Posts: 1,463
09-12-2005 00:42
I think you are aiming the Push() in the wrong direction. First, it should be local (set the last parameter to True), second it shouldn't push that much (<5,0,5> instead of <100,0,100>, for example), third it should aim backwards instead of forward (<-1,0,0> is backward, <1,0,0> is forward) ;)
_____________________
Either Man can enjoy universal freedom, or Man cannot. If it is possible then everyone can act freely if they don't stop anyone else from doing same. If it is not possible, then conflict will arise anyway so punch those that try to stop you. In conclusion the only strategy that wins in all cases is that of doing what you want against all adversity, as long as you respect that right in others.
Julian Fate
80's Pop Star
Join date: 19 Oct 2003
Posts: 1,020
09-12-2005 01:22
BamBam, you might elaborate on what sort of effect llPushObject() did have that you found undesireable. The code seemed to work fine to me although Jesrad is right, it is aiming in the wrong direction. And maybe I'm gaining weight but <-100,0,100> felt a little weak. :)

Edit: After further testing, <-100,0,100> is a helluva boost, but for some reason in the above code it only gives me a gentle nudge. <-200,0,200> was about right.
Jesrad Seraph
Nonsense
Join date: 11 Dec 2004
Posts: 1,463
09-12-2005 02:36
The force with which something is pushed by something else depends apparently on both objects' masses and the distance between them... That makes it very trial-and-error-prone :o You'll have to revise the value of the push effect everytime the object's shape changes...
_____________________
Either Man can enjoy universal freedom, or Man cannot. If it is possible then everyone can act freely if they don't stop anyone else from doing same. If it is not possible, then conflict will arise anyway so punch those that try to stop you. In conclusion the only strategy that wins in all cases is that of doing what you want against all adversity, as long as you respect that right in others.
BamBam Sachertorte
floral engineer
Join date: 12 Jul 2005
Posts: 228
09-12-2005 11:09
From: someone
BamBam, you might elaborate on what sort of effect llPushObject() did have that you found undesireable. The code seemed to work fine to me although Jesrad is right, it is aiming in the wrong direction. And maybe I'm gaining weight but <-100,0,100> felt a little weak.
It seemed to do nothing. The action was identical whether the push was done or not. I will tweak the push strength once I get some sort of noticable effect. For now, I don't care if it hurls be three sims over.

I put <100,0,100> as the push vector because the avatar is sitting at <-5, 0, 0> in the local coordinates of the prim containing the push script. Is this the right way to think about llPushObject()? Or should the push vector be in the avatar's coordinate space?
Ushuaia Tokugawa
Nobody of Consequence
Join date: 22 Mar 2005
Posts: 268
09-12-2005 11:56
From: BamBam Sachertorte

What am I missing?


Have you defined a sit target?
_____________________
BamBam Sachertorte
floral engineer
Join date: 12 Jul 2005
Posts: 228
09-12-2005 13:45
From: someone
Have you defined a sit target?
Yes I have. That part appears to work right.
BamBam Sachertorte
floral engineer
Join date: 12 Jul 2005
Posts: 228
09-13-2005 08:59
Well,
CODE
llPushObject(sitter, <-7500, 0, 7500>, ZERO_VECTOR, TRUE);
had a significant effect. I guess I needed a large impulse because the pushing prim was low mass. But it was linked to a set of prims that mass much more than an avatar, go figure. But there were two issues that prevent this from being the solution.
  1. The prims with the sit targets are part of a link set and they are arrayed radially around the root prim. The impulse vector acted like it was in the coordinate system of the root prim, not the avatar. So the avatar would be pushed in the right direction (backward) on some prims, but not on most.
  2. Even on the magic prim where this llPushObject() worked, it would only work 75% of the time. About 25% of the time the impulse was in a random direction. I think the problem is that the avatar is in the process of unsitting from the linkset containing the prim doing the push. Maybe the delay before the llPushObject() is executed affects the vector. I dunno.

Setting the local flag to FALSE seemed to cause the impulse vector to be in world coordinates (although the documentation is vague on this). This seems like it may be more promising, I just need to compute the impulse vector in world coordinates. But there was a wierd variability in push strength. If I have a magic prim where the impulse vector is just right and I rotate the link-set under the avatar and have it sit on another prim with a sit target then the impulse direction is still correct but my avatar is sent flying 50m.

This is probably due to some 1/r^3 effect. 'r' does not appear to be the distance between the avatar and the prim running the push script. Does anybody have experience using llPushObject() in a linked prim with the local flag set to FALSE?
Padraig Stygian
The thin mick
Join date: 15 Aug 2004
Posts: 111
09-13-2005 15:22
I am also having some sincerely bizarre llPushObject() problems. I'm just trying to write a simple script to jump out of a cake, and either I end up in the next sim, or there's no push, at all. So it's not just you...
_____________________
(You): Aww! My pants won't rez! Does this texture look okay on me?

Incidental Radio :: Because nothing is by design
Now featuring Torley-tastic technomusic!
BamBam Sachertorte
floral engineer
Join date: 12 Jul 2005
Posts: 228
09-14-2005 08:28
Now I have really entered the Twilight Zone. I took out the llPushObject() and moved the sit target away from the edge. And I changed the sit animation from "sit" to "sit_ground". But my avatar is still being thrown 50m! Could this be some wierd byte code caching bug?