Physics: Bug in llPushObject() -- wildly inconsistent push forces
|
|
Scalar Tardis
SL Scientist/Engineer
Join date: 5 Nov 2005
Posts: 249
|
06-22-2007 14:41
This post has been a long time in development, but I seem to have discovered a serious problem with how the llPushObject() command operates while trying to build a simple physics demonstration toy. The project was intitially very simple. A huge 10m x 10m x 0.065m prim has a three-line pusher script inside to push anything that collides with it, with a vector force of <0,0,10>. A tiny 0.450m physical sphere bounces around touching the big prim. It seems that the push force on the small sphere is wildly inconsistent across the surface of the large prim. On a wide ring around the outer edges of the big prim, the push force is too small to even lift the little sphere. BUT in the very center of the large prim, in about a 2 meter diameter circle, the push force is insanely strong, kicking the marble up to 20 meters high. In the very center of the big prim, it blasts marbles up to 110 meters high! (Might go higher yet, if not for someone else's build up in the sky above my test platform.) Meanwhile the energy level of the big prim is all over the place during the test. In the center, a big kick barely takes anything out of the prim's energy level. But around the edges where the push force is too small to do anything, it is burning up all available pusher energy, pulling it down to less than 5% of normal. While a much larger push force such as <0,0,300> can make the outer edges push hard enough to lift the sphere, it also makes the center force astronomically high, puncing objects through barriers over 0.5 meters thick and shooting it out of the sim. I have built a test-bed so that you -- and the Lindens -- can try this out for yourself. Push the start button to drop a grid of spheres onto the big platform, and observe how the little spheres move (and don't move). After about two minutes the spheres disappear and you can try the test again, if you don't believe this weirdness you're seeing. http://slurl.com/secondlife/Chilbo/207/26/93I have always been told to build things huge when doing physics, due to unreliability problems with small objects. This is probably the primary cause of most small-object physics weirdness. This problem seems serious enough that it should be put into the JIRA bug-reporting system. -Scalar
|
|
Qie Niangao
Coin-operated
Join date: 24 May 2006
Posts: 7,138
|
06-22-2007 16:57
If I understand the posting, isn't this the expected fall-off of force as a cube function of distance from the center of the pushing object?
|
|
Scalar Tardis
SL Scientist/Engineer
Join date: 5 Nov 2005
Posts: 249
|
06-22-2007 17:13
I do not understand your wording of "expected". How can this behavior be expected?
The wiki says "The push will fall off proportional to the cube of the distance (radius) between the two objects."
The two objects are touching all across the surface of the 10m x 10m platform. Drop a marble anywhere on the surface of the platform and the distance between the marble and the platform is zero.
-Scalar
|
|
Qie Niangao
Coin-operated
Join date: 24 May 2006
Posts: 7,138
|
06-22-2007 17:30
It's very possible I misconstrued "the very center of the large prim", which I understood to mean the volumetric center (or origin) of the prim, and one would expect the force at the surface of a sphere of radius r to be 1/r^3 the force at the origin. But if, rather, there are fluctuations across the *surface* of a uniform sphere, that is certainly *not* expected.
[Edit: the large prim isn't a sphere, but nonetheless, the falloff is from a point: the origin of the prim? its center of mass?--not from its surface.]
|
|
Scalar Tardis
SL Scientist/Engineer
Join date: 5 Nov 2005
Posts: 249
|
06-22-2007 17:47
I think I see what you're trying so say. The force has do do with the center of the object only, and not the actual SHAPE / "contact surface" of the object. It apparantly only cares about the centerpoint and the shape has no involvement, which seems very weird. Though, it doesn't look like the wiki equation is correct, because my experimental test reveals a reversal of my push forces -- uniformly strong around the edge, but dropping off in the very center, so that the force is LOWEST in the center. collision (integer num_detected ) { float impulse = 1; integer i; for (i = 0; (i < num_detected) ; i++) { float pushcalc = impulse * llPow( llVecDist( llGetPos(), llDetectedPos(i) ), 3); llPushObject( llDetectedKey(i), <0, 0, pushcalc > , ZERO_VECTOR, 0); } }
The equation is apparantly overcompensating.. Results:  -Javik
|
|
Qie Niangao
Coin-operated
Join date: 24 May 2006
Posts: 7,138
|
06-22-2007 17:57
Now *that* is unexpected! (scratches head)
|
|
Lex Neva
wears dorky glasses
Join date: 27 Nov 2004
Posts: 1,361
|
06-23-2007 09:16
I've run into the inconsistency of llPushObject() before, and I have to say that it's mostly a black box to me. There seems to be some kind of inverse-cubic falloff as stated in the Wiki, but it doesn't ALWAYS come into play... it seems that if the pushee is inside the pusher, then sometimes falloff isn't applied. I think there's also some attenuation of the push based on relative masses... or more importantly, the drop in "energy" seems to take into account the relative masses, and so the push will often get attenuated because the pusher runs out of energy. Finally, if you're pushing objects with varying masses, I believe you need to multiply the push impulse by the mass of the object being pushed in order to get a consistent result across all pushees.
You can see the closest my friends and I have ever come to consistent pushes in the sim Suffugium. Fly up from where you teleport in and go to the rooftops nearby. You'll find little chalked arrow markers at the edges of some roofs. Just walk into one, and you'll be pushed at a fairly precise speed to land you exactly on another arrow on a different roof. This took a whole heck of a lot of math and guesswork and a lot of experimentation to work around llPushObject()'s limitations. The system actually does ballistic calculations (using a quadric polynomial equation found on wikipedia... ugh!) to "solve" for the proper push strength to land someone at a given point on another roof. It's accurate within a few meters.
|
|
Scalar Tardis
SL Scientist/Engineer
Join date: 5 Nov 2005
Posts: 249
|
06-24-2007 13:17
The main problem I am finding is that the force does not drop off from the center in a nice smoothly curving shape with a single high peak in the center. .....................*.................... ...................*..*.................. .................*......*................ .............**..........**............ ....****...................****.... No, instead for some reason there is a high but equal-force plateau in the center, that will kick multiple spheres all up to the SAME uniform height, and then abruptly drop the force way down as you get away from the center. ..............*****.............. ............*.........*............. ...........*...........*............ ..........*.............*........... ..****..................****.. This result is of course highly annoying because it is nonlinear. How am I supposed to compensate for a plateau'd force effect???  -Scalar
|
|
Seifert Surface
Mathematician
Join date: 14 Jun 2005
Posts: 912
|
06-24-2007 22:21
I've used llVolumeDetecting prims pushing objects while they are inside the pusher, and got pretty uniformly accurate results, without any fall-off compensation. I also know of people who have got good control at a distance from the prim, and the cubic falloff appears to be right. Things only seem to be weird at the boundary of the prim.
_____________________
-Seifert Surface 2G!tGLf 2nLt9cG
|