• Advertisement
Sign in to follow this  

Erratic Collision Response

This topic is 1402 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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?

Share this post


Link to post
Share on other sites
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.

Edited by LorenzoGatti

Share this post


Link to post
Share on other sites

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.

Edited by Buckeye

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement