GLBasic forum

Main forum => Off Topic => Topic started by: backslider on 2011-Mar-18

Title: A Small Box2D Physics Test
Post by: backslider on 2011-Mar-18
Hi guys,

I played around with Box2D and GLBasic and this is the result:
http://www.youtube.com/watch?v=5iDxDnS0JK4 (http://www.youtube.com/watch?v=5iDxDnS0JK4)

I´ve tested on Palm Pré, it works pretty well! :)

Sorry for the ultra low quali ;)

cheers
Title: Re: A Small Box2D Physics Test
Post by: Ian Price on 2011-Mar-18
It might be small, but it looks like it's well formed!

Nice one :)

Any chance of posting the code?
Title: Re: A Small Box2D Physics Test
Post by: backslider on 2011-Mar-18
Thanks Ian!

Maybe I will post the code. But not yet, first I want to change some things. :)
But you can "play" the alpha demo that you can see in the video.

Info:
- Don´t add more than 7 vertices per shape, otherwise the app crashes. (work in progress)
- Draw the shapes clockwise, otherwise the shape won´t interact with the world.
- If you press only mousebutton left then the shape has mass and will fall down
    - if you press "S" AND mousebutton left then you will have a static shape without mass.

Have fun... Next time I will add more videos OR the code. :P or both^^

cheers


[attachment deleted by admin]
Title: Re: A Small Box2D Physics Test
Post by: erico on 2011-Mar-18
nice demo, will try when I get home!
Title: Re: A Small Box2D Physics Test
Post by: msx on 2011-Mar-18
I wait impatiently for the code, I want to work with these libraries a long time ago but I do not understand very well.

If the code is finally public, I will rejoice.

Thanks  anyway.
Title: Re: A Small Box2D Physics Test
Post by: erico on 2011-Mar-19
tried the code, it works pretty fine! great :O
Title: Re: A Small Box2D Physics Test
Post by: D2O on 2011-Mar-19
Dont work.
See movie:

http://www.deuteriumoxid.com/glbasic/shape.wmv (http://www.deuteriumoxid.com/glbasic/shape.wmv)
Title: Re: A Small Box2D Physics Test
Post by: Neurox on 2011-Mar-19
Quote from: D2O on 2011-Mar-19
Dont work. See movie:
http://www.deuteriumoxid.com/glbasic/shape.wmv (http://www.deuteriumoxid.com/glbasic/shape.wmv)

You have used twelve vertices for the shape but Backslider wrote :
Don´t add more than 7 vertices per shape, otherwise the app crashes. (work in progress)

Title: Re: A Small Box2D Physics Test
Post by: matchy on 2011-Mar-19
That's very cool. I suppose the way to create shapes with more that 7 sides is to weld addition shapes to make the final shape.
Title: Re: A Small Box2D Physics Test
Post by: D2O on 2011-Mar-19
Quote from: Neurox on 2011-Mar-19
You have used twelve vertices for the shape but Backslider wrote :
Don´t add more than 7 vertices per shape, otherwise the app crashes. (work in progress)

Oops, thank you. I come exactly from the night shift, must want be somewhat blind =D
Title: Re: A Small Box2D Physics Test
Post by: bigsofty on 2011-Mar-19
Nice demo!  :good:


Was the callback issue sorted with Box2D?


Title: Re: A Small Box2D Physics Test
Post by: backslider on 2011-Mar-19
Thanks,

bigsofty, I don´t understand your question, sorry. :D
Title: Re: A Small Box2D Physics Test
Post by: Ian Price on 2011-Mar-19
That is really cool, however items drawn clockwise have no effect on those drawn anti-clockwise, other than a brief pause on collision. Is this intentional?
Title: Re: A Small Box2D Physics Test
Post by: backslider on 2011-Mar-19
This is the Box2D Engine, not my code. I´m only drawing the line and then I pass the point coordinates array to the b_CreatePoly function. ;)
But I will try to use the shape edges from Box2D. Than it should work in both directions and with more than 7 vertices per line.

cheers.
Title: Re: A Small Box2D Physics Test
Post by: Ian Price on 2011-Mar-19
:)
Title: Re: A Small Box2D Physics Test
Post by: bigsofty on 2011-Mar-20
Quote from: backslider on 2011-Mar-19
Thanks,

bigsofty, I don´t understand your question, sorry. :D

Sorry my reply was vague, there was a problem with the lack of contact listener functions within the box2d GLBasic headers. Have they been implemented?

Cheers,


Ian
Title: Re: A Small Box2D Physics Test
Post by: backslider on 2011-Mar-20
Hm, I have used the Box2D Code from the first post in the Box2D Thread.
If it isn´t the latest version, then it could be.
I think, later I will post my code.
Then erverbody can play around with it. hehe. ;)

cheers.
Title: Re: A Small Box2D Physics Test
Post by: bigsofty on 2011-Mar-20
Cool!

Thank you,


Ian
Title: Re: A Small Box2D Physics Test
Post by: backslider on 2011-Mar-21
OK guys,

if you want, you can download the code.
Have fun! ;)

[attachment deleted by admin]
Title: Re: A Small Box2D Physics Test
Post by: matchy on 2011-Mar-21
Very good and it Box2D is fun to experiment.