Problem with Collisions

Official forum for the Chipmunk2D Physics Library.
hussain.ali
Posts: 2
Joined: Wed Sep 24, 2008 7:32 am
Contact:

Problem with Collisions

Hello guys,
I've been working on a game in which objects collide with each other then bounce perfectly (i.e the elasticity is 1). The problem is that when there are a few objects on the screen like say 3 or 4 everything works fine, but when the number of objects increase to say more than 5, the objects start running totally wild. i was wondering whether there's a way to control the forces/acceleration so that they do not go above a certain threshold, but i can't find any yet....

Any help would be greatly appreciated.

Thanks,
Hussain
supertommy
Posts: 56
Joined: Tue Sep 11, 2007 2:30 pm
Contact:

Re: Problem with Collisions

I think the documentation warns against using 1.0 or higher for elasticity. Does it work well if you set it to something close, but not quite 1.0? 0.95 or something?
hussain.ali
Posts: 2
Joined: Wed Sep 24, 2008 7:32 am
Contact:

Re: Problem with Collisions

yup, i've set the elasticity to 0.9, it works fine when there are just 3 or 4 objects... but the problem is that when there are more objects they keep on colliding with each other more and more, and i think the forces acting on them start to increase so they start moving totally widely.

Is there a way in which we can limit the forced/velocity/acceleration to some certain value so that even if a lot of collisions occur, the velocity of the objects don't increase dramically...

thanks..

hussain
ker
Posts: 56
Joined: Tue Jul 15, 2008 4:13 am
Contact:

Re: Problem with Collisions

you could check every objects rotational speed and velocity every frame and simply cut it off at a certain maximum. You'd have the most control over the outcome that way.

if you just want to control the velocity you could use a cpBodyVelocityFunc (http://code.google.com/p/chipmunk-physics/wiki/cpBody)

Who is online

Users browsing this forum: No registered users and 2 guests