Talk:LlPushObject
Push drop-off
As the avatar retreats from the prim that contains the script doing the pushing, the amount of force imparted reduces. I have read some references (on the LSLWiki,) to the idea that the force is f = 1 / r^3
where f is the force applied and and r is the distance (radius) between the prim and the object being pushed. But this doesn't seem to to be valid. I've been using the below code to calculate the push, but it only seems to invert the curve. IE: Standing inside the (phantom) prim at it's center gives no push at all, while being a few meters away gives one whale of a shove.
Here's my code (Abridged for cleaner posting):
sensor(integer num_detected) { for (index = 0; index < num_detected; ++index) { // Yes, I know better than to initialize variables inside a loop. This is demo code ;) key avviKey = llDetectedKey(index); vector direction = <1.0, 0.0, 0.0> * llGetRot(); float massComp = llGetObjectMass(avviKey); float falloffComp = llPow(llVecDist(llGetPos(), llDetectedPos(index)), 3); // (1 / r^3) * r^3 = 1 / 1 = 1 llPushObject(avviKey, direction * massComp * falloffComp, ZERO_VECTOR, FALSE); } }
Like I said, when my avatar is standing in the center of the prim the value of direction * massComp * falloffComp
is equal to <0, 0, 0>
while further out I am the more of a push I get. What am I missing? Cron Stardust 21:45, 19 April 2007 (PDT)
- *makes minor change to your script* try flying when you get pushed, that should eliminate the effects of gravity for your experiment. I'm curious to see how things come out. Also be aware that there is a ceiling on how large a push can be. --Strife Onizuka 23:18, 19 April 2007 (PDT)