Skip to content

Commit 40d4abd

Browse files
committed
Update README.md
Update to 0.6.0.
1 parent 063c99b commit 40d4abd

1 file changed

Lines changed: 6 additions & 6 deletions

File tree

README.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -44,11 +44,11 @@ Like really easy, but if you have to use rvm or rbenv you will also know what to
4444

4545
You need to `require 'pbox2d'` in the the usual way (to require a gem). Now you should create a new instance of Box2D. However as in this included [example][] you may also need to `include ContactListener` interface (by [jruby magic][], including the interface as a module implements the java interface) if you wish to create your own jbox2d listener.
4646
```ruby
47-
@box2d = Box2D.new(self)
48-
box2d.init_options(gravity: [0, -20]) # this is new since version 0.2.0
49-
box2d.create_world
47+
# Since version 0.6.0, use the WorldBuilder factory module (avoids boiler-plate code)
48+
# Only app is required there, default gravity is [0, -10], defaults to warm start
49+
@box2d = WorldBuilder.build(app: self, gravity: [0, -20])
5050
```
51-
That's about all you need to know, to use the box2d instance to access the jbox2d physics world. Since version 0.2.0 runtime options `scale`, `gravity`, `warm_start`, and `continous_physics` option should be set using the `init_options` method see above (if unset sensible defaults are used). The `step_options` are set in the same way, but default options are often suitable. NB: You do not need to call `box2d.step` in the draw loop, to update the physics world, because we do that for you under the hood (using java reflection arghhh.....).
51+
That's about all you need to know, to use the box2d instance to access the jbox2d physics world. Since version 0.6.0 runtime options `scale`, `gravity`, `warm_start`, and `continous_physics` options can be set using the keyword args see above (if unset sensible defaults are used). The `step_options` are set in the same way, but default options are often suitable. NB: You do not need to call `box2d.step` in the draw loop, to update the physics world, because we do that for you under the hood (using java reflection arghhh.....).
5252
The other thing you should know is there is a mismatch between the physics world and the sketch world (processing got it wrong to my view, down is up), further the scaling is different. This is why you need to keep translating from one worlds (coordinates system) to the others coordinates (system), Dan Shiffman explains it in his [Nature of Code book][], Chapter 5 physics libraries, not that I've read it, I prefer to read code or [Sandi Metz][]. The really brave or adventurous should probably get [this book].
5353

5454
[JBox2D Home]:http://www.jbox2d.org/
@@ -60,6 +60,6 @@ The other thing you should know is there is a mismatch between the physics world
6060
[Nature of Code book]:http://natureofcode.com/
6161
[Sandi Metz]:http://www.poodr.com/
6262
[this book]:http://www.crcpress.com/product/isbn/9781466565760
63-
[zip]:https://github.com/ruby-processing/jbox2d/archive/0.5.0-pre.zip
64-
[tar]:https://github.com/ruby-processing/jbox2d/archive/0.5.0-pre.tar.gz
63+
[zip]:https://github.com/ruby-processing/jbox2d/archive/0.6.0.zip
64+
[tar]:https://github.com/ruby-processing/jbox2d/archive/0.6.0.tar.gz
6565
[Wiki]:https://github.com/ruby-processing/jbox2d/wiki

0 commit comments

Comments
 (0)