This site requires JavaScript, please enable it in your browser!
Greenfoot back

Report as inappropriate.

RcCookie presents ...



This is a Greenfoot version of the well-known 2d physics engine "Box2D" by Erin Catto. More specificly this is actually a port from "JBox2D", a java port for the Box2D engine which is written in C++.

> Box2D website:
> JBox2D website:

Box2D features precise collisions for any convex chaped polygon, circles and more. Additionally it fearures joints like springs. Most importantly though: Its performance is incredible.
Note that due to its independent nature Box2D can't draw its shapes so that is something you will have to do. It's not hard though.

What I actually did is simply move some folders and creating some helping classes that simplify the structure to create and work with the engine.
You can easily reuse these classes and the whole engine in your scenarios by copying the "org", the "rccookie" folder and the license file over into your scenario's folder.

Below you find a simple demo showing of some simple parts of the Box2D engine. Left-click to add circles, which can be adjusted using the ui. Middle-cling to add boxes and right-click to add static walls.

445 views / 67 in the last 7 days

5 votes | 1 in the last 7 days

Tags: mouse game simulation physics demo with-source collision engine box2d

open in greenfoot
Your browser does not support the canvas tag.
A new version of this scenario was uploaded on 2020-10-26 21:10:50 UTC Added thumbnail
A new version of this scenario was uploaded on 2020-10-26 21:12:16 UTC Fixing bugs
A new version of this scenario was uploaded on 2020-10-26 21:15:12 UTC Fixed bug
A new version of this scenario was uploaded on 2020-10-26 21:21:36 UTC Improved demo


You should add the force of friction, without it it does not look plausible a little.


You mean that it is adjustable?


No, you just need to add the friction force, of course, if you have a completely smooth surface this can be avoided.


The physics engine does use sliding friction, it’s defaulted to .2 though.


It's just that the object is sliding for too long, even though it should stop. Perhaps you should make the coefficient of friction more.

Want to leave a comment? You must first log in.

Who likes this?

CmogSmok Just_in Awesome_Gabe Kostya20052011 Roshan123