Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

predictive positioning?

Rotten Thatch
Registered User
Join date: 28 Mar 2005
Posts: 21
06-08-2005 10:23
I was doing some work with predictive positioning for an avatar using llDetectedVel() and I have been running into an issue of being unable to accurately pinpoint where the avatar is by the end of the calculations within the sensor. The way that it works, is that it's kinda slow to get to the point where the object moves toward the avatar.

I decided to instead add llGetAndResetTime() as a multiplier to velocity on each successful positioning, but I am running into the issue that I can't tell quite how long it's been since the sensor fired. It seems pretty reliable, but something tells me it always estimates time since the last sensor by at least a little bit. I know sometimes the time resets on a whim, but it's not undershooting that I am worried about. it's overshooting.

I am trying to think of more accurate ways of doing it but I am drawing a blank. Is this the best way?
Strife Onizuka
Moonchild
Join date: 3 Mar 2004
Posts: 5,887
06-08-2005 10:45
You seem to running into the problem of your script not executing fast enough. Post it to the forums and i'll pick it apart so it will run faster.
_____________________
Truth is a river that is always splitting up into arms that reunite. Islanded between the arms, the inhabitants argue for a lifetime as to which is the main river.
- Cyril Connolly

Without the political will to find common ground, the continual friction of tactic and counter tactic, only creates suspicion and hatred and vengeance, and perpetuates the cycle of violence.
- James Nachtwey
Jeffrey Gomez
Cubed™
Join date: 11 Jun 2004
Posts: 3,522
06-08-2005 15:02
From: Strife Onizuka
You seem to running into the problem of your script not executing fast enough. Post it to the forums and i'll pick it apart so it will run faster.

Ditto. Plus if the physics is wonky, I should be able to help.

That B- in Physics with Cal has to count for something! :D
_____________________
---
Rhysling Greenacre
Registered User
Join date: 15 Nov 2003
Posts: 132
06-08-2005 16:44
doesn't the script self correct? that is, if it overshoots the target, wouldn't it turn around and come back?
Rotten Thatch
Registered User
Join date: 28 Mar 2005
Posts: 21
06-08-2005 21:46
actually it already runs as fast as I can make it. there are practical limits when you want to make something chase people through damage sims.

It runs as fast as the functions I need to use to locate the person and move the prim will allow on a sensor loop. Anyway, it works, but I am afraid what would happen if I tried it in a more laggy sim than grass.

IE with following objects (I use llSetPos beacause nonphysical == non-pushable) if the person is moving oftentimes an object no matter how fast it is moving can't keep up because in the lag between the sensor and the movement calculations the person is already moved a bit away from the position they were sensed at. that's why I originally made the predictive position idea. I am just trying to brainstorm ways that it may break so that I can make it better.

EDIT: the more I think about it the more I realize that little bit of overshooting may be a positive thing as long as it's not too much.
Exchange Street
Registered User
Join date: 6 Sep 2004
Posts: 69
06-09-2005 11:47
The autopilot script I made that powers the automated 737 and balloon flights from Abbotts Aerodrome uses predictive positioning so flight is smooth instead of oscillating violently.

Caveats I ran into and had to fix include:
  1. adding a "gain" control to determine how far in the future to look based on 1) my preference and 2) sim lag.
  2. Use current position, omega (at least for vehicles... not sure if that would work well in your situation), and gain to determine the exact point the object will be.


Finally, what are you trying to create? An avatar-seeking missile? If so, then it seems to me that you would need to do predictive math to figure out where both the avatar AND the object are going to be otherwise you'll miss your mark every time.
Apotheus Silverman
I write code.
Join date: 17 Nov 2003
Posts: 416
06-09-2005 11:48
The autopilot script I made that powers the automated 737 and balloon flights from Abbotts Aerodrome uses predictive positioning so flight is smooth instead of oscillating violently.

Caveats I ran into and had to fix include:
  1. adding a "gain" control to determine how far in the future to look based on 1) my preference and 2) sim lag.
  2. Use current position, omega (at least for vehicles... not sure if that would work well in your situation), and gain to determine the exact point the object will be.


Finally, what are you trying to create? An avatar-seeking missile? (that's just what it sounds like) If so, then it seems to me that you would need to do predictive math to figure out where both the avatar AND the object are going to be otherwise you'll miss your mark every time.
_____________________
Apotheus Silverman
Shop SL on the web - SLExchange.com

Visit Abbotts Aerodrome for gobs of flying fun.
Rotten Thatch
Registered User
Join date: 28 Mar 2005
Posts: 21
06-09-2005 14:30
Well, I don't need to determine where the object is, because if it is in the positioning part it has already determined that it is too far from the target to clip, and shouldn't be made physical or non-phantom yet.

The gain I use doesn't have to be arbitrary because it is exact less the time it actually takes between the call of llSensor and when it records what it senses. The only time it really starts messing up are times where the avatar is accelerating or decelerating, and the script usually kicks in fast enough to put them at a constant velocity by the next call. Again, I know it works because it killed everyone in rausch without fail for over a half hour with people constantly trying to get near me and [failing to] kill me.