You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+6-6Lines changed: 6 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -44,11 +44,11 @@ Like really easy, but if you have to use rvm or rbenv you will also know what to
44
44
45
45
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.
46
46
```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
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.....).
52
52
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].
53
53
54
54
[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
0 commit comments