[ODE] slider trouble

Nate W coding at natew.com
Fri Nov 1 22:13:01 2002


  This message is in MIME format.  The first part should be readable text,
  while the remaining parts are likely unreadable without MIME-aware tools.
  Send mail to mime@docserver.cac.washington.edu for more info.

--1363170581-1279554879-1036185734=:7964
Content-Type: TEXT/PLAIN; charset=US-ASCII

On Thu, 31 Oct 2002, Russ Smith wrote:

> nate, can you verify the fix?

Unfortunately, no... I've attached another test that bounces things off
the ground a bit differently, and you can watch two blocks bounce skyward
and then gradually spin up to an explosion.

How's this for an alternate approach: apply the linear force created by
the joint stop at each body's center of mass, but apply it in the
direction of the other body's center of mass, rather than along the slider
axis (project the force vector along the direction of the other body's
center of mass).  Would that also cancel out the torque effect, without
adding torques to the bodies explicitly?

Also, could this problem be related to the problem where a single flying
spinning body also gains angular momentum?  I actually saw the
slider-limit acceleration problem months ago, but I mistook it for the
explicit integration problem described in the FAQ in 11.12.

-- 

Nate Waddoups
Redmond WA USA
http://www.natew.com


--1363170581-1279554879-1036185734=:7964
Content-Type: TEXT/PLAIN; charset=US-ASCII; name="test_sliderstops.cpp"
Content-Transfer-Encoding: BASE64
Content-ID: <Pine.LNX.4.21.0211011322140.7964@spiral>
Content-Description: 
Content-Disposition: attachment; filename="test_sliderstops.cpp"

LyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioq
KioqKioqKioqKioqKioqKioqKioqKioqKioqKioNDQogKiAgICAgICAgICAg
ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
ICAgICAgICAgICAgICAgKg0NCiAqIE9wZW4gRHluYW1pY3MgRW5naW5lLCBD
b3B5cmlnaHQgKEMpIDIwMDEsMjAwMiBSdXNzZWxsIEwuIFNtaXRoLiAgICAg
ICAqDQ0KICogQWxsIHJpZ2h0cyByZXNlcnZlZC4gIEVtYWlsOiBydXNzQHEx
Mi5vcmcgICBXZWI6IHd3dy5xMTIub3JnICAgICAgICAgICoNDQogKiAgICAg
ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
ICAgICAgICAgICAgICAgICAgICAgKg0NCiAqIFRoaXMgbGlicmFyeSBpcyBm
cmVlIHNvZnR3YXJlOyB5b3UgY2FuIHJlZGlzdHJpYnV0ZSBpdCBhbmQvb3Ig
ICAgICAgICAqDQ0KICogbW9kaWZ5IGl0IHVuZGVyIHRoZSB0ZXJtcyBvZiBF
SVRIRVI6ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICoNDQog
KiAgICgxKSBUaGUgR05VIExlc3NlciBHZW5lcmFsIFB1YmxpYyBMaWNlbnNl
IGFzIHB1Ymxpc2hlZCBieSB0aGUgRnJlZSAgKg0NCiAqICAgICAgIFNvZnR3
YXJlIEZvdW5kYXRpb247IGVpdGhlciB2ZXJzaW9uIDIuMSBvZiB0aGUgTGlj
ZW5zZSwgb3IgKGF0ICAqDQ0KICogICAgICAgeW91ciBvcHRpb24pIGFueSBs
YXRlciB2ZXJzaW9uLiBUaGUgdGV4dCBvZiB0aGUgR05VIExlc3NlciAgICAg
ICoNDQogKiAgICAgICBHZW5lcmFsIFB1YmxpYyBMaWNlbnNlIGlzIGluY2x1
ZGVkIHdpdGggdGhpcyBsaWJyYXJ5IGluIHRoZSAgICAgKg0NCiAqICAgICAg
IGZpbGUgTElDRU5TRS5UWFQuICAgICAgICAgICAgICAgICAgICAgICAgICAg
ICAgICAgICAgICAgICAgICAgICAqDQ0KICogICAoMikgVGhlIEJTRC1zdHls
ZSBsaWNlbnNlIHRoYXQgaXMgaW5jbHVkZWQgd2l0aCB0aGlzIGxpYnJhcnkg
aW4gICAgICoNDQogKiAgICAgICB0aGUgZmlsZSBMSUNFTlNFLUJTRC5UWFQu
ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKg0NCiAq
ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
ICAgICAgICAgICAgICAgICAgICAgICAgICAqDQ0KICogVGhpcyBsa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