Anyone know how can I start to learn box2d ?
Or how can I apply some examples find in other box2d tutorials for Gideros? (www.iforce2d.net/)
I watched the Gideros tutorial but i see in same case Gideros use in other solution.
Ad example I didn't find the B2Vec, and I see Gideros initialize the world and body in different mode.
Thanks a lot for any help.
If you are interested in Box2d physics, you can try out these tutorials from basics up to some elements:
oh and don't forget this resource:
Likes: ___, cokeramirez, snooks
Likes: ar2rsawseen, snooks
I read a little your articles, and I search it , also there how can I adapt C++ examples and found for b2vec , but without success.
If I understand well Gideros use only x , y , and not a table for b2vec.
Is it normal I found only 25 approximatelly articles (without duplicated articles), if I search box2d in the forum ?
Well forum search is not the best search to try, but if you count only threads, not posts, then yeah, it could be about 20-25 threads about box2d. Mostly questions for support
Like what is a body and what is the relation to a sprite, what is the role
of a fixture, shapes, etc. I think (but I am not a Box2D guru yet) that you
can explain it in an easy way graphically. I searched a lot but I couldn't
find a tutorial like that. Also this very important part is still missing in
the "Ultimate Guide". I think that this is more interesting than creating
I checked out the articles on appcodingeasy.com, but there is no explanation of a) the available physics methods and b) what their parameters mean. So you feel completely stuck :-(
Still I agree there should be more on physics in Gideros, and maybe even series of blog posts.
1. Clean up or remove any physics bodies (from both, world and memory)?
2. Remove a created world (created with local World = b2.World.new(0, 9.8) )?
And everything is removed automatically when the reference to object is lost.
So if you have everything in local variables, they will be available for garbagecollector after you are outside the scope
If everything is stored as Sprite object property, then they will be removed once both sprite and world get removed.
World gets removed again when there is no reference to it, so if world is scene property, it will be available to garbage collector, after you change the scene
What about scaling objects, by the way? If I apply a box2D polygon shape and a body to my sprite and want to scale the sprite afterwards, am I allowed to do so? Or do I have to re-create the physics shape then?
More info on that
And library itself:
While I am getting into this, I wonder if there is a way to simulate buoyancy to simulate bodies floating in liquids. How could this be achieved?
You draw a water line (a sensor body, for example) and if body intersects with it and collisions is in center (depending on the shape it can be easier or harder to determine), on each enter frame you apply force to it, which equals inverted world gravity, so body would float in the water.
The deeper the body in the water the bigger force should be applied, so you will need to find some kind of coefficient to multiply the inverted gravity force based on the distance of the body center under the water line, again on each enter frame.
If body is out of the water (upper part of the water line), then you don't apply anything there.
Here is more detailed info:
to give a simple understanding, i like to get the effect they have in Flappy Bird, but dont worry, I am not making a flappy bird clone. lol.
The recommended method is to apply linear impulse at every step. The result is the same as linear velocity, but also fully compatible with collisions.
The code below is the basis of what I'm using in my current project for both a jump and scroll behavior. The idea is that you insert the action function into the step only for as long as you need to move, then remove it.
Once inserted into step, your velocity will instantly change to desired rate and hold thereafter. Keep in mind, impulse does not constrain velocity, but instead applies the necessary forces upon the body in order to achieve the desired effect.