Re: dartbox2d - change log

Skip to first unread message

Dominic Hamon

Mar 20, 2013, 12:09:07 PM3/20/13
to Martin Sikora,
Hi Martin

Don't worry about bothering me, but do consider using the mailing list as others will be interested in your findings. I've added it to the 'to' line in this email.

That is a strange bug. It looks like it might be JS only as the VM tests have checksums that were within expected variance of the non-vector_math version. I haven't tried dartium yet but that would be an interesting test.

There are two possibilities:
  - i made a mistake in the vector_math integration and introduced a subtle bug
  - vector_math has a bug that causes this behaviour

The former is much more likely so i'll take another look over my patch to see if i can find anything. otherwise, i'll bring in the vector math guru to see what he thinks.

Dominic Hamon | Google
There are no bad ideas; only good ideas that go horribly wrong.

On Wed, Mar 20, 2013 at 3:04 AM, Martin Sikora <> wrote:
Hi Dominic,

I'm sorry to bother you again but I think I found a weird bug in
dartbox2d 0.1.1 with vector_math but I admit it's hard to reproduce.

The first thing is that objects freeze in the air. You can see it on
this screenshot or try On my
OS X 10.7, Chrome 25 and Firefox 19.0.2 it always ends like this with
two planes in the air. What is weird is that objects that don't move
are grey, while these two are red so it looks like they are somehow

The second problem is that objects somehow overlap each other. I
wasn't able to make some reliable demo that would reproduce this
problem but you can see it on these two screenshot from the game I
sent you last time. and It
looks like objects are unable to recover properly from collisions.
Maybe the two problems are somehow related but unfortunately I don't
have such knowladge of physics engines to figure out what's wrong by

I uploaded new version of my game to
If you mess with the boxes a little I think you'll come across both
problems that I described above.
The old version based on dartbox2d 0.0.7 is still available here and these
problems never happen there.
I thought the problem might in the way I drag boxes because I just
give them velocity but it worked correctly in dartbox2d 0.0.7.
I tried to use the latest vector_math 0.9.7 and waited for Dart SDK
0.4.2 because I thought the problem might be somewhere there but it
didn't help. Also I looked at changes that you made in dartbox2d since
0.0.7 but I didn't see anything suspicious.

I'm sorry I can't provide any better information.

Best regards,
Martin Sikora

On Wed, Mar 13, 2013 at 12:31 AM, Dominic Hamon <> wrote:
> Hi Martin
> Thanks for using it, and thanks for the link. It's really slick, very nicely
> done.
> The closest I have to a changelog is the list of commits
>, though I also tag every
> version in the repository to make it a little easier to see what's changed.
> Most of the recent updates have been maintenance just keeping up with SDK
> changes. If you come across any bugs or have any suggestions, I'm happy to
> hear them.
> Thanks again!
> Dominic Hamon | Google
> There are no bad ideas; only good ideas that go horribly wrong.
> On Tue, Mar 12, 2013 at 1:25 PM, Martin Sikora
> <> wrote:
>> Hello Dominic,
>> my name is Martin and I want to thank you for making dartbox2d!
>> I used it last month in a hackathon in Prague to make a simple puzzle
>> game called Physics After Dart. You can try live demo here
>> or see
>> source codes on github
>> I didn't win anything
>> but it was fun :).
>> I wanted to ask you if you keep some change log so I can easily see
>> what's new in new versions and also to be able to refactor my own code
>> to reflect your changes. I saw that you started using vector_math
>> library which is great! I want to make some simple tutorials on how to
>> use dartbox2d and put them on my blog and change log would help me a
>> lot to keep it uptodate.
>> Best regards,
>> Martin Sikora

Dominic Hamon

Mar 21, 2013, 6:17:47 PM3/21/13
to Martin Sikora,

I have confirmed that this also happens in Dartium, which is probably a good thing as it shows that it's not a JS generation issue which would be a royal pain to debug.

The next step would be to try to find a smaller testcase or debug the domino test. I'll see what I can do but it might take me a while to dig into it as this isn't my day job.

- dominic

Martin Sikora

Mar 22, 2013, 6:08:50 AM3/22/13
to Dominic Hamon,
Hello Dominic,

I didn't mention it in my previous mail but I also tested it on
Chronium that comes with Dart SDK 0.4.2 but it didn't make any

I tried to add some prints to the code just to see what's going on
inside. The two planes in DominoTest have some linearVelocity (which
is very slowly decreasing to 0). It looks like gravity force has no
effect on them. Also in ContactManager::collide() there 5 or 6
contacts all the time, even when they are stuck in the air.

I also tried to make some changes in World class. There's
_continuousPhysics variable which I thought by its name controls
whether the simulation is discrete or continuous. It's hardcoded to
_continuousPhysics=true (line 109) but when I tied to change it to
false it helped in both cases.
In DominoTest the two planes don't freeze in the air and it also fixed
that strange overlaping in my game. I uploaded another version with
_continuousPhysics=false so you can try it if you want
I don't understand why it helped because comment on like 65 says "This
is for debugging the solver." but later in World::step() method it
controls whether method World::solveTimeOfImpact(); is called. So
maybe the problem is somewhere there.

I'll try to review particularly changes since 0.0.7 that might be
related to solveTimeOfImpact() and see if I can find something there.
I hope it's not just a coincident that it helped :).


Dominic Hamon

Mar 22, 2013, 12:49:40 PM3/22/13
to Martin Sikora,
It seems then that there's a bug in the time of impact solver probably related to clearing of contact lists. That gives me something to look at, thank you so much for your analysis.

Dominic Hamon | Google
There are no bad ideas; only good ideas that go horribly wrong.

Dominic Hamon

Mar 22, 2013, 3:28:43 PM3/22/13
to Martin Sikora,
A quick update - I think the problem is that the root finder in timeOfImpact is running out of iterations. This causes collision resolution to fail and for objects to start a frame overlapping which causes all kinds of issues.
Reply all
Reply to author
0 new messages