llMoveToTarget in at_target getting stuck? Bug?
|
Kral Playfair
Registered User
Join date: 8 Aug 2004
Posts: 24
|
08-30-2004 02:39
I'm trying to make a physical object bounce. Problem is, the object often gets 'stuck'. It's like SL ignored my llMoveToTarget. Even stranger, if you just right-click on it but do nothing, or if it has a listen() callback and you say something, it gets unstuck! Wtf? The event system getting screwed up or something? I'm guessing this is a common problem, so hopefully one of you smarties can help me out here.  To replicate the problem: Create a jumble of boxes (happens faster with more objects it seems), link them, make them physical, put them in the air so you don't have to worry about ground collisions, and add this script. Should happen within 50 bounces. Boggle in amazement as actions like right-clicking cause it to unstick. --- // - Kral Playfair
vector bouncePosition; integer goingDown;
float bounceDampSpeed = 0.2; vector bounceVector = <0, 0, 2>; float targetFuzzyness = 0.5;
integer targetHandle;
default { state_entry() { // Take the spawn location as where we should bounce from. bouncePosition = llGetPos(); // Bootstrap. goingDown = TRUE; llMoveToTarget(bouncePosition, -bounceDampSpeed); targetHandle = llTarget(bouncePosition, targetFuzzyness); } at_target(integer tnum, vector targetpos, vector ourpos) { llWhisper(0, "tnum: " + (string) tnum + " targetpos: " + (string) targetpos + " ourpos: " + (string) ourpos + " goingDown: " + (string) goingDown + " energy: " + (string) llGetEnergy()); // Clear the target. llTargetRemove(targetHandle); // If we were going down when we hit the target, bounce up. if(goingDown) { targetHandle = llTarget(bouncePosition + bounceVector, targetFuzzyness); llMoveToTarget(bouncePosition + bounceVector, bounceDampSpeed); goingDown = FALSE; } // Otherwise, we're at the apex, let's fall. else { targetHandle = llTarget(bouncePosition, targetFuzzyness); llMoveToTarget(bouncePosition, -bounceDampSpeed); goingDown = TRUE; } } }
|
Moleculor Satyr
Fireflies!
Join date: 5 Jan 2004
Posts: 2,650
|
08-30-2004 04:15
*blinkblink*
Wow. I'd never heard of llTarget until today.
_____________________
</sarcasm>
|
Azelda Garcia
Azelda Garcia
Join date: 3 Nov 2003
Posts: 819
|
08-30-2004 05:01
Without looking in detail, I did notice: llMoveToTarget(bouncePosition, -bounceDampSpeed);
The second argument to movetotarget is a time period, something like the half-life for the move, and will generally be positive. Azelda
|
Kral Playfair
Registered User
Join date: 8 Aug 2004
Posts: 24
|
08-30-2004 11:15
From: someone Originally posted by Azelda Garcia Without looking in detail, I did notice:
llMoveToTarget(bouncePosition, -bounceDampSpeed);
The second argument to movetotarget is a time period, something like the half-life for the move, and will generally be positive.
Azelda You can remove both of the "-"s and still get the same bug. They're a leftover I missed.
|
Azelda Garcia
Azelda Garcia
Join date: 3 Nov 2003
Posts: 819
|
08-30-2004 21:07
Interesting. 50 objects you say? You cant reproduce it with 2 or 3? Could be a lag bug, ie some update packets are being lost, so your client isnt displaying them. When you interact with the object again, new update packets are sent.
Does that sound like it could fit the observed effects?
Azelda
|
Kral Playfair
Registered User
Join date: 8 Aug 2004
Posts: 24
|
08-31-2004 05:57
From: someone Originally posted by Azelda Garcia Interesting. 50 objects you say? You cant reproduce it with 2 or 3? I've had fewer objects in a link set bounce 1,100 times before they got stuck. Gluing a mess of them together usually triggers it within 60 seconds. You can try out my method and that script and see what I mean. From: someone Could be a lag bug, ie some update packets are being lost, so your client isnt displaying them. It appears to be server-side, not client-side, since the object receiving a listen() will unstuck it, even if listen() is a no-op. Also, I don't get the llWhisper events until it unstucks, and when it does, no messages have been skipped, as the numbers are sequential. I'll check tomorrow if this is still a bug with 1.5.
|
Luke Ramona
Registered User
Join date: 3 Apr 2005
Posts: 32
|
05-19-2005 14:52
Getting the same problem with my new simple object that moves around on an X,Y plane. It will around for a random amount of time and then just get stuck for no reason. Then you either say something to it (using the command channel) or touch it, and it starts moving again. I put some Debug messages into place and started it up and it seemed to go for a bit longer (may be because it was sending messages) but eventually got stuck again. The debug messages sent a "moving to" message and an "at position" message. When it got stuck it was because it failed to generate an "at position" message.. meaning that the at_target event did not fire... yet it fired EVERY other time and with a simple touch, it starts up again.. firing the at_target event everytime it reaches the target until, once again, it becomes stuck again. I have some Swans in my pond at my house that must be using a very similar script with the difference being that they NEVER stop or get stuck.... so there MUST be a workaround to this bug somewhere. Here is the at_target event I am using: at_target(integer number, vector targetpos, vector ourpos) { if (debug == 1) { llOwnerSay("At Pos"); }
llTargetRemove(targetID); llStopMoveToTarget(); llSetStatus(STATUS_PHYSICS, FALSE);
if (pet_moving == 1) { move_pet(); } }
|
Zalandria Zaius
Registered User
Join date: 17 Jan 2004
Posts: 277
|
kooky physics
05-20-2005 07:24
I'm guessing it's caused by SL's kooky physics..
Ever tried to make a swing out of a hinge joint? It will randomly stop up in the air LOL.. not real physical like.. Maybe 1.7 with it's fancy Havok 2 will fix some of this..
|