Objects Overlap on Low Speeds

Official forum for the Chipmunk2D Physics Library.
Post Reply
cmuser
Posts: 2
Joined: Fri Jun 20, 2008 10:06 am
Contact:

Objects Overlap on Low Speeds

Post by cmuser »

Hi all,

First of all, let me point out how I love the chipmunk lib! :)

I need to create some kind of a billiard game.
Instead of billiard balls I'm using square polygons.
I have created 8 identical polygons and a space (the "table") with no gravitation, but with damping=0.5 to emulate the friction of the billiard table.
I set an initial speed vector to a polygon and watch the polygons collide.

Direct collisions work well, especially at high speed.
But when a polygon is spinning at low speed (when it's about to stop), sometimes its corner can overlap an other polygon without generating a collision.

I've been playing with different chipmunk parameters for several days, but still haven't eliminated the overlap completely, which happens from time to time.

Could anybody advise me what parameter to play with, please?

Please, help.
maximile
Posts: 157
Joined: Mon Aug 20, 2007 12:53 pm
Location: London, UK
Contact:

Re: Objects Overlap on Low Speeds

Post by maximile »

Have you set cp_collision_slop to 0? If that's not it, then I guess it could be this (from the docs): "Pointy or thin polygons aren’t handled well. Collision points are generated at the poly’s vertexes. I haven’t decided what to do about this yet."
User avatar
slembcke
Site Admin
Posts: 4166
Joined: Tue Aug 14, 2007 7:13 pm
Contact:

Re: Objects Overlap on Low Speeds

Post by slembcke »

cmuser: Could you be more specific? How much do they overlap? Are you sure it isn't a drawing issue?

maximile: That's describing when two polygons overlap, but neither contains vertexes from the other poly (like a David's Star for example).
Can't sleep... Chipmunks will eat me...
Check out our latest projects! -> http://howlingmoonsoftware.com/wordpress/
cmuser
Posts: 2
Joined: Fri Jun 20, 2008 10:06 am
Contact:

Re: Objects Overlap on Low Speeds

Post by cmuser »

to maximile & slembcke:
thank you very much for your advices!

Sorry, it was really a bug in drawing! Used wrong angle in rotation. :oops:

One more question:
I'm moving objects on a table (top view).
The objects are moving in zero-gravity in the space (= table surface), to substitute the friction of the table I use the space damping parameter.
Is there a better way to represent the table friction (in order not to use space damping)?
Michael Buckley
Posts: 46
Joined: Tue Aug 21, 2007 10:30 am
Contact:

Re: Objects Overlap on Low Speeds

Post by Michael Buckley »

You could probably stop the apply a small force opposing the object each frame. When the speed of the object gets too slow in a direction, you'll want to stop the object and stop applying the force.
Post Reply

Who is online

Users browsing this forum: No registered users and 7 guests