Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Killing Momentum?

Tiberious Neruda
Furry 'On File'
Join date: 1 Nov 2005
Posts: 261
08-20-2007 11:45
Ok, here's the setup:

Using the examples from the wiki, I managed to work out a little homing missile-type item that goes after the closest non-me person within a 40m radius (uses a single SetForce to act as propulsion, and obviously it's also buoyant). In testing, though, when it passes through a target and turns around, each time it does so, it gets further from the person, as opposed to closer, and starts almost orbiting them, depending on how they and it moves.

How can I reliably keep this thing from getting too fast and still retain some of the characteristics it has now (such as changing targets midflight and being 'avoidable')?
Jotheph Nemeth
Registered User
Join date: 9 Aug 2007
Posts: 142
08-20-2007 12:48
I haven't tried this, but will vector llGetForce() return the remaining force in the object or will it merely return the amount of the setforce that had been applied?

Are you calculating the force required based on the distance to the target each time, including when it turns? Or are you using a set amount of force?
Shadow Subagja
Registered User
Join date: 29 Apr 2007
Posts: 354
08-20-2007 13:43
Well when you use llSetForce you are giving it a constant thrust. Sounds like that is too fast. Consider reducing it as the proximity closes to prevent the whizzing-through?
Noctua Janus
Registered User
Join date: 22 Mar 2007
Posts: 29
08-21-2007 10:42
You could try to call llSetPrimitiveParams([PRIM_PHYSICS, False]); and then back to a physical object with a new force..
Lex Neva
wears dorky glasses
Join date: 27 Nov 2004
Posts: 1,361
08-21-2007 10:47
You could use llApplyImpulse instead of llSetForce, because, as others pointed out, the latter will keep applying the same level of thrust, accelerating your object to higher and higher velocities. You could also balance the llSetForce() with friction using the Vehicle system... although combining the Vehicle system with llSetForce() may be unsupported.
Lee Ponzu
What Would Steve Do?
Join date: 28 Jun 2006
Posts: 1,770
08-21-2007 13:32
There are a lot of ideas available for this on the Internet. Try googling "boids" and "flocking" and "reynolds" (I think).

In your case, it sounds like leaving llSetForce() on will cause it to go faster and faster. If you check the velocity once in awhile, you can reduce the force as you get closer to some max velocity threshold. The crudest version would be

if (GetVel() > MAX)
then
SetForce(0)
Tiberious Neruda
Furry 'On File'
Join date: 1 Nov 2005
Posts: 261
08-21-2007 20:30
I'm trying to work with friction on the side-to-side movement, but the wiki help for vehicles is nearly non-existant, and so I've tried everything I can think of, but nothing seems to be working...
Gordon Wendt
404 - User not found
Join date: 10 May 2006
Posts: 1,024
08-21-2007 20:57
From: Tiberious Neruda
I'm trying to work with friction on the side-to-side movement, but the wiki help for vehicles is nearly non-existant, and so I've tried everything I can think of, but nothing seems to be working...


if wiki.secondlife.com doesn't have what you need try lslwiki.net they have more info on the lsl commands though I think even they don't have much on physics calls since those are fairly undocumented wherever you go so your probably stuck doing trial and error.
_____________________
Twitter: http://www.twitter.com/GWendt
Plurk: http://www.plurk.com/GordonWendt

GW Designs: XStreetSL