Erratic Collision Response

Started by
1 comment, last by Buckeye 10 years, 1 month ago

First off I'm using the physics engine "Jitter Physics" (http://code.google.com/p/jitterphysics/)

Two boxes colliding sometimes ends in both of them flying off in random directions. I have done quite a few modifications to the engine to support what I'm trying to do with it. Is there a common cause of this that I can look for?

Advertisement

I have done quite a few modifications to the engine to support what I'm trying to do with it. Is there a common cause of this that I can look for?

Bugs in your engine modifications, unless the original Jitter engine has the same problems.

How can you expect help without giving any detail of what you are doing? Common immediate causes of "flying off in random directions" include forces proportional to interpenetration depth (of unexpectedly large magnitude) and naive choices for the direction of such forces, but your problem might be less common.

In any case, your choices of accuracy tradeoffs (e.g. allowing interpenetration in order to limit forces), collision response rules (e.g. constraining bounce directions) and physically meaningful hacks (e.g. inelastic collisions) depend on your game's needs.

Omae Wa Mou Shindeiru

As in most debugging efforts, a better approach than guessing/hacking is to find out what the problem is.

- create a reproducible example

- go to a part in your code where the problem manifests itself

- examine the data coming into that code, and the data going out of that code.

- the problem then is IN the code you're looking at, before that section, or after that section.

Follow the data and values. IF your starting values/data are good, find a place where it's bad. The problem is in-between.

Just FYI, the chances of posting a general description of a problem and someone posting "I had exactly the same problem. Change x=5 to x=6," are extremely unlikely.

Please don't PM me with questions. Post them in the forums for everyone's benefit, and I can embarrass myself publicly.

You don't forget how to play when you grow old; you grow old when you forget how to play.

This topic is closed to new replies.

Advertisement