Sign in to follow this  
YOLO

Erratic Collision Response

Recommended Posts

YOLO    151

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
LorenzoGatti    4442

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
Buckeye    10747

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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this