Unsolvable(-ed) collisions

Official forum for the Chipmunk2D Physics Library.
Post Reply
Niken
Posts: 1
Joined: Mon May 26, 2014 2:34 am
Contact:

Unsolvable(-ed) collisions

Post by Niken »

Hi All,
I'm new to Chipmunk and seeking for an advice.
I have following environment: a linked graph, where nodes are simple rectangles and shapes are circular (all nodes have same sizes/shapes). The nodes are connected with damped springs.
Some of the nodes are fixed (their mass is set to 1.0e+32f), others have mass 1.0f (I'd call non-fixed nodes as floating).
There is initial layout of nodes, but user may change positions of any nodes by D&D.
Problem is following: if for whatever reason a floating node is put in between of fixed ones, thus collision of shapes is not solvable (e.g. you have a triangle of fixed nodes, and then drop a floating node in center of the triangle), the node starts "dancing".
I guess on each step of the solver, it gets an impulse to get away from one collision side, next - will be some other "neighbor" collision considered.

When I (user) try to move one or another fixed nodes, often it comes to situation, that the floating node will be freed from the "jail", but also often I get assertion:

Aborting due to Chipmunk error: Body's position is invalid.
Failed condition: cpfabs(v.x) != INFINITY && cpfabs(v.y) != INFINITY

Please note that this "dancing" may last very long, if I don't change layout, only when fixed nodes are moved, sometimes it leads to the assertion above. Also I can't confirm that assertion happens when a fixed node is in movement - seems like movement is finished, floating node gets another level of freedom, then assertion happens.

My guess will be that I need to identify such problematic case and solve collision programmatically (stop floating node from dancing). I also don't know why I get this assertion (principally my program just sets initial positions and let Chipmunk to handle physics of collisions and springs).
Does anybody have an advice, or, if available, an example for such case?

Thanks in advance!
Nick
Post Reply

Who is online

Users browsing this forum: No registered users and 4 guests