Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

llPushObject vs llApplyImpulse

Bloodsong Termagant
Manic Artist
Join date: 22 Jan 2007
Posts: 615
06-24-2008 07:44
heyas;

what's the difference between these two? aside from the fact they use different parameters :X


is one less laggy than the other? more cotrolled than the other? is one preferred over the other for use in a speed boost attachment?

the wikis are kinda vague about both.
_____________________
Why Johnny Can't Rotate:
http://forums.secondlife.com/showthread.php?t=94705
Hewee Zetkin
Registered User
Join date: 20 Jul 2006
Posts: 2,702
06-24-2008 09:54
For one thing llApplyImpulse() only works on the object the script is in (or the avatar that object is attached to if it is an attachment).

With llPushObject() there is supposed to be a 1/r^3 term in there, but I suspect there's a sanity check in it that prevents the effect from being INCREASED for small (or zero) radius, so I kind of doubt that will help any.

Note however that if you want a sudden burst of speed, you might try coordinating multiple objects to all give a push as close as possible to the same time.... This sort of works for attachments and llApplyImpulse() too because each attached object has its own pool of energy, but not many people want to attach 15 things to their avatars, so a rezzing strategy and pushes might work a little better.
Bloodsong Termagant
Manic Artist
Join date: 22 Jan 2007
Posts: 615
06-26-2008 09:37
heyas;

ah, i see. i found that out this morning looking at someone's push script that didnt work. (in no push region.) i thought: hey, use impulse... then saw there's no target.


i have no idea what you're talking about for r3^3 thingies. and that's okay too :X


since it is an attachment, and it only ever affects the owner... does it then make absolutely no difference between which one you use?

and no, i dont want a sudden burst of speed, i want to make the avatar running speed higher. like 15m/s instead of 5m/s (i think that's what it is).


hm... okay, so... being that it is an attachment.... if i make a .5m box and wear it, and have x force push in the script.... would that totally change if i changed the box to a 1.5m box? or hollowed it or whatever that makes it lighter/less energy?
i totally dont understand energy.
_____________________
Why Johnny Can't Rotate:
http://forums.secondlife.com/showthread.php?t=94705
Hewee Zetkin
Registered User
Join date: 20 Jul 2006
Posts: 2,702
06-26-2008 11:11
From: Bloodsong Termagant
...i want to make the avatar running speed higher. like 15m/s instead of 5m/s (i think that's what it is).

hm... okay, so... being that it is an attachment.... if i make a .5m box and wear it, and have x force push in the script.... would that totally change if i changed the box to a 1.5m box? or hollowed it or whatever that makes it lighter/less energy?
i totally dont understand energy.

For that kind of minor speed adjustment (and for an avatar) you aren't going to run out of energy, so maybe don't worry about it until you get into more extreme applications. The size (mass) of the object doesn't matter if it is an attachment; attachments all get the same amount of energy, and get it back at the same rate. I wouldn't be surprised if they push with the same force too, but in any case I'd definitely use llApplyImpulse() for your case. It works well and is very predicable for this kind of thing.

You could also experiment with llMoveToTarget() to pull the target toward a point out in front (you'd have to continually be moving the point, but you're going to have to adjust impulses periodically too so it shouldn't be a great deal different). Both llApplyImpulse() and llMoveToTarget() and llApplyImpulse() can work well for this, so whether and how much you experiment with the latter as an alternative is totally up to you.
Ordinal Malaprop
really very ordinary
Join date: 9 Sep 2005
Posts: 4,607
06-26-2008 11:35
Personally I would use llApplyImpulse over llPushObject when it comes to an attachment pushing the avatar, on the basis that

1. it is likely to be more efficient, as it only ever applies to the one object i.e. the avatar;
2. it is quicker to write the code as the function is simpler;
3. llPushObject seems, er, a little unpredictable with Havok 4 (I am not sure whether this is down to other issues, but why take the risk?)

Bear in mind that I think that the bug still exists whereby, if you recompile a script using llApplyImpulse whilst the attachment is still attached, you will have to detach and reattach the thing in order for llApplyImpulse to work. Otherwise it doesn't do anything. This has caused a lot of bruised foreheads during development at times, though once you know about it it is just a tiny irritation (and does not affect scripts once complete).
_____________________
http://ordinalmalaprop.com/forum/ - visit Ordinal's Scripting Colloquium for scripting discussion with actual working BBCode!

http://ordinalmalaprop.com/engine/ - An Engine Fit For My Proceeding, my Aethernet Journal

http://www.flickr.com/groups/slgriefbuild/ - Second Life Griefbuild Digest, pictures of horrible ad griefing and land spam, and the naming of names
Bloodsong Termagant
Manic Artist
Join date: 22 Jan 2007
Posts: 615
06-27-2008 09:09
heyas;

oh yes, i remember that crazy bug/feature.

i think youre right about the havok 4 on push. its really been screwing with the giant snail races.

i dont really adjust the impulse power. im getting velocity and if its between 4.8 and 12, i apply the impulse on the timer; otherwise i dont, so i dont over-boost. seems to work fine, if not creating a steady speed.

my compatriot who is using llpush, on the other hand.... has a lot of trouble with accidentally boosting people into walls.