Graphic interface for editing 2d physical object would be something for all those (including myself) amateurs to get going. Creating a custom file format and graphical editor is far too much for a non-professional programmer. Including such an editor and a parser to read its creations into the game would be nice and I am sure it would spawn some cool gameMaker-like following resuluting in lost of fine 2dphysics based game stuff. Are there any plans concerning physics editor in Box2d?
Editor?
Games and ApplicationsI would not be the person to create such an editor, but I would totally support such an effort. Such editors almost become games themselves, so I would enjoy playing with one.
Interactive Physics http://www.design-simulation.com/IP/index.php is a fine example of a 2D physics editor used in education.
Interactive Physics http://www.design-simulation.com/IP/index.php is a fine example of a 2D physics editor used in education.
I built a crude Box2d physics editor:
http://sourceforge.net/project/showfile ... _id=197381
It's an ongoing project (latest version in CVS).. So far you can draw/place
Static lines (Ground)
Lines (thin boxes)
Boxes
Triangles
Circles
Pyramids with boxes
Pyramids with circles
Ragdolls
Towers with boxes
Stairs (draw line)
Stairs (boxes)
Bridges
Domino lines
1-9 and Q,W,E,R,T,Y pick options...
Z,X,C - increase/decrease sizes
A,S,D change density, friction, etc.
You press O to export the current scene into C++ source. Joints are supported, but I'm storing them so it's almost done.
TODO:
Attractors/replusors (i.e black holes, magnets etc.)
Vector fields (ala Loco Roco)
Turbulence fields
Polygon shapes
Cogs
Simple car
I plan to add as many as features as possible then clean up the UI
http://sourceforge.net/project/showfile ... _id=197381
It's an ongoing project (latest version in CVS).. So far you can draw/place
Static lines (Ground)
Lines (thin boxes)
Boxes
Triangles
Circles
Pyramids with boxes
Pyramids with circles
Ragdolls
Towers with boxes
Stairs (draw line)
Stairs (boxes)
Bridges
Domino lines
1-9 and Q,W,E,R,T,Y pick options...
Z,X,C - increase/decrease sizes
A,S,D change density, friction, etc.
You press O to export the current scene into C++ source. Joints are supported, but I'm storing them so it's almost done.
TODO:
Attractors/replusors (i.e black holes, magnets etc.)
Vector fields (ala Loco Roco)
Turbulence fields
Polygon shapes
Cogs
Simple car
I plan to add as many as features as possible then clean up the UI
Voxel, that's really cool! You even have a ragdoll!
It seems like some of the tuning is off. I'm guessing you are using pixel units? You'll probably need to tune some of the settings in b2Settings.h. I'm guessing most length units should be increased by about 100x.
I'll post a link to this on the links page.
It seems like some of the tuning is off. I'm guessing you are using pixel units? You'll probably need to tune some of the settings in b2Settings.h. I'm guessing most length units should be increased by about 100x.
I'll post a link to this on the links page.
Erin Catto wrote:
Voxel, that's really cool! You even have a ragdoll!
It seems like some of the tuning is off. I'm guessing you are using pixel units? You'll probably need to tune some of the settings in b2Settings.h. I'm guessing most length units should be increased by about 100x.
I'll post a link to this on the links page.
It seems like some of the tuning is off. I'm guessing you are using pixel units? You'll probably need to tune some of the settings in b2Settings.h. I'm guessing most length units should be increased by about 100x.
I'll post a link to this on the links page.
Thanks. I'll post an updated version this week with more features.
As for units, I use raw 3D units and render in "2D." The default are probably too small. I use 2.5 as the default box size...
EDIT: I think the units map to pixel width pretty closely and probably shouldn't.
Yes, it's weird that I am using a 3D engine to render 2D art. I could easily stick 6 different box2d simulations and draw each onto a cube face.
I just added polygon drawing, but it asserts (when checking the normals in shape creation) if the polygon is concave or the points were specified in clockwise order. I'll probably need to create a b2Utils class with functions like isConvex(), etc..
A convex hull tool is on the TODO list. That will come in a month or so. Fortunately convex hulls are a lot simpler in 2D.
A tool to convert a concave shape into a number of convex shapes would be nice as well 😎
I plan to support edge soups for static level geometry. These will be placed in an AABB tree for fast processing.
Convex decomposition wouldn't be hard for closed polygons. In the worst case I could just triangulate the polygon.
Both the convex hull code and the convex decomposition code could be contributions because they are external utilities.
Convex decomposition wouldn't be hard for closed polygons. In the worst case I could just triangulate the polygon.
Both the convex hull code and the convex decomposition code could be contributions because they are external utilities.
If anyone wants to take up the convex decomposition, the Hertel-Mehlhorn algorithm (a Google search should turn something up) is probably a good start; it's reasonably quick, produces close to optimal decompositions (usually quite a bit better than a triangulation), and is pretty easy to program. The basic idea is to triangulate the non-concave polygon and then remove "inessential" diagonals until you can't remove any more, at which point you're done. To do much better requires moving to an algorithm with much higher complexity. I don't have time to code it right now, so if someone else is up for it, give it a shot. Otherwise in a little while I may get around to it.
Christer Ericson's book has an explanation of this somewhere around page 500 - found it on Google book search, though alas, you cannot read the first part of the explanation.
You're right, though, for now, even just a triangulation would probably do, especially since Hertel-Mehlhorn requires one to start with anyways (I forget if it needs to be a particular sort of triangulation, though). There are a lot of different ways to do this, ear clipping is probably the easiest, and since this calculation really only happens on shape initialization, it doesn't matter too much that it's not the fastest: http://cgm.cs.mcgill.ca/~godfried/teach ... _ears.html .
Christer Ericson's book has an explanation of this somewhere around page 500 - found it on Google book search, though alas, you cannot read the first part of the explanation.
You're right, though, for now, even just a triangulation would probably do, especially since Hertel-Mehlhorn requires one to start with anyways (I forget if it needs to be a particular sort of triangulation, though). There are a lot of different ways to do this, ear clipping is probably the easiest, and since this calculation really only happens on shape initialization, it doesn't matter too much that it's not the fastest: http://cgm.cs.mcgill.ca/~godfried/teach ... _ears.html .
I've posted a little video:
http://casuallyhardcore.com/blog/?p=100
As for the source:
http://sourceforge.net/projects/musicala (CVS is best)
The file Box2DSystem.cpp contains all useful box2d related creation calls that all the demos use. i.e ragdolls, bridges, etc. Feel free to borrow from it.
The editor will be dormant for a little while as I'm working on another project for the next few weeks.
http://casuallyhardcore.com/blog/?p=100
As for the source:
http://sourceforge.net/projects/musicala (CVS is best)
The file Box2DSystem.cpp contains all useful box2d related creation calls that all the demos use. i.e ragdolls, bridges, etc. Feel free to borrow from it.
The editor will be dormant for a little while as I'm working on another project for the next few weeks.
Original thread: https://box2d.org/forum/viewtopic.php?t=11