Physics: How to prevent slow-object freezing
|
Scalar Tardis
SL Scientist/Engineer
Join date: 5 Nov 2005
Posts: 249
|
12-23-2005 02:02
One of my big interests on SL is exploring the capabilities of the physics engine to see what is possible to do with it.
A problem I've discovered is that if an object moves too slowly it will freeze solid in place and never move again until you manually move it a little. I assume this is intended as an optimizing effect of the physics engine, so that if an object is motionless for a certain period of time it is dropped from the "things to update" list, and therefore conserves the computational power of the sim.
However, an object doesn't have to be motionless to get dropped from the update queue. It seems that an object just moving very slowly can also freeze solid if it moves too slowly for more than half a second.
A consequence of this is that a free-swinging pendulum behaves very oddly. After just one or two swings it will freeze solid on the UPSWING. Er, what? Yes, as it reaches the end of a swing it slows, then reverses to go the other way. It just so happens to be slow enough for the sim to stop updating it, and it freezes in place up in the air.
However, something else I've discovered is that the physics engine does not seem to know how to deal with inherently unstable systems where one free-moving physics enabled object is attached to or bound by another free-moving physics-enabled object. Try to make a physics-enabled chain and the links will jiggle around wildly, rather than just hang straight down in a stable lowest-energy state.
So one way to keep a pendulum going is to put a very small ball inside a hollow pendulum weight . The inherent instability of the physics engine will cause the ball to constantly wiggle around inside the weight.
This constant Brownian wiggling of the second object is enough to counteract the freezing effect of the sim when the pendulum slows down.
|
Seifert Surface
Mathematician
Join date: 14 Jun 2005
Posts: 912
|
12-23-2005 02:15
Wow! Very cool. What does the weight do to the period of the pendulum though? I would imagine that the system loses energy as the ball bounces around inside?
_____________________
-Seifert Surface 2G!tGLf 2nLt9cG
|
Scalar Tardis
SL Scientist/Engineer
Join date: 5 Nov 2005
Posts: 249
|
12-23-2005 03:10
I started the last experiment right before the Island Sandbox started it's 12hr region cleanup, so no long-term testing has been done. I'm sure it sounds nuts, but I'm working on a clock-sprocket and pawl system to go with the pendulum. Tick... tock... 
|
Nepenthes Ixchel
Broadly Offended.
Join date: 6 Dec 2005
Posts: 696
|
12-23-2005 06:30
Another trick it to place a physics enabled object on a non-physics enabled vehicle, then move the vehicle down away from the object; the object remains in the air.
|
Scalar Tardis
SL Scientist/Engineer
Join date: 5 Nov 2005
Posts: 249
|
12-23-2005 07:04
Yes, when a physical object stops moving it essentially becomes a non-physics-enabled object from the engine's point of view.
If a ball falls into a cup, and stops, you can pull the cup straight down and the ball hangs motionless like any other non-physics object. The sim is ignoring it and no longer updating it.
Now, personally, I don't see a big problem with this, and I can see why it is done. Imagine your physics project blows up, and leaves parts scattered and lost around the sim. Those parts will take a while to find and remove, but without this "feature" all the while they'd be jiggling around and constantly eating CPU cycles.
It'd be nice to control when this physics-optimizing takes effect, such as "if object does not move more than 0.05m after 5 seconds, then stop processing". The pendulum would constantly exceed this limit until it was damped down to near motionless, while a random ball that rolls away somewhere would stay motionless long enough to get immediately dropped from the physics-update queue.
|
Beatfox Xevious
is THOUSANDS OF PEOPLE
Join date: 1 Jun 2004
Posts: 879
|
12-23-2005 12:17
Another trick you can use to conteract freezes is to place a script that periodically applies an impulse of 0. I used this for my jointed windchimes, and although freezes can still be seen if you watch carefully, they only last a fraction of a second before the next zero-impulse is applied.
_____________________
My Beatworks: Zephyr Chimes wind chimes, the KanaMaster Japanese kana tutor, and the FREE Invisibility Prim Public. Look for them at the Luskwood General Store in Lusk (144, 165).
"You have been frozen. You cannot move or chat. A pony will contact you via instant message (IM)." - mysterious system message I received after making off with Pony Linden
|
Jora Welesa
Dark Lady of the Sith
Join date: 11 Jul 2005
Posts: 153
|
12-23-2005 17:19
From: Scalar Tardis I started the last experiment right before the Island Sandbox started it's 12hr region cleanup, so no long-term testing has been done. I'm sure it sounds nuts, but I'm working on a clock-sprocket and pawl system to go with the pendulum. Tick... tock...  How interesting.  I'm working on a clock myself. I've done the gear ratio math and built my gears. Problem is that when you get them too close together, having them physics enabled makes the whole thing blow apart. Oops. Perhaps we can get together IW and do a bit of working together on this. GOAL: Accurate timepiece that relies 100% on the physics engine. No scripting. 
|
Argent Stonecutter
Emergency Mustelid
Join date: 20 Sep 2005
Posts: 20,263
|
12-26-2005 08:55
From: Nepenthes Ixchel Another trick it to place a physics enabled object on a non-physics enabled vehicle, then move the vehicle down away from the object; the object remains in the air. You can do it even in a physics enabled vehicle. I had to put a roof on my physics-based elevator because people and objects left in it would remain stuck in the air when it started down.
|
Argent Stonecutter
Emergency Mustelid
Join date: 20 Sep 2005
Posts: 20,263
|
12-26-2005 08:58
From: Jora Welesa Problem is that when you get them too close together, having them physics enabled makes the whole thing blow apart. Oops. The collision envelope for physical objects is a little larger than the object. You need to make the object pretty big to avoid this problem.
|