Box2D module


#1

I’ve just added a Box2D module - have fun with physics!


#2

:smiley:


#3

Hi Jules !

What is the idea behind this module ?

Its it for internal use ( ComponentAnimator ?) or for real game builders ?


#4

It’s for whatever you want - games, demos etc. I’ve not integrated it into any existing juce animation classes, just made the box2d library easily available if you want to use it. It’s a nice API, very simple, and a good compliment to juce’s graphics.


#5

Jules did you have to edit his source code very much to make it build as a single .cpp ?


#6

Almost nothing apart from the include paths (…why do people insist on using absolute paths in projects with subdirectories?? sigh…)


#7

Just started to play with this now. I have question about the render() method of the Box2DRenderer class.

How do the co-ordinates map from “float left, float top, float right, float bottom” to “const Rectangle& target”?
Could you give an example say if I wanted to draw to a 400x400 component for instance?

I’ve had various attempts but I can’t see anything even though I have the hello Box2d scene set up from the manual :?


#8

Box2d coords are pretty wacky, it’s all inverted and scaled - the Box2DRenderer class might be helpful