I need to create some physic complex bodies with circular shapes, it is possible?
Thanks [import]uid: 13040 topic_id: 5023 reply_id: 305023[/import]
I need to create some physic complex bodies with circular shapes, it is possible?
Thanks [import]uid: 13040 topic_id: 5023 reply_id: 305023[/import]
I was just going to post the same question myself!
In my case, my specific example is the top of a pinball machine. I want to have a round edge to the top of the screen so when I fire a ball at it from the pinball plunger the ball will follow the curve of the top edge until gravity takes over and brings the ball down.
Same need is for curved shoots and rails where I want the ball to follow a curved path around the pinball table.
Currently I know Corona will handle simple circular shapes (like balls). I wonder if a poly-line shape would work for this, but I’m worried that a bunch of line segments would ruin the smooth effect I’m looking for with a true curved surface.
Physics with bezier curves would be awesome if it was possible! [import]uid: 12529 topic_id: 5023 reply_id: 16424[/import]
Anybody know if this is currently possible or how I go about getting it onto the roadmap for the future? I really need this kind of functionality. [import]uid: 12529 topic_id: 5023 reply_id: 16924[/import]
http://developer.anscamobile.com/forum/2010/12/12/bezier-curves-corona-source-code [import]uid: 6645 topic_id: 5023 reply_id: 17000[/import]
That’s certainly a good start, but it doesn’t look like the bezier curves are really integrated with the physics engine yet. Looks like it would be a lot of work just to add curved surfaces to the edge of a pinpall table layout and handle how the ball responded.
I’m still hoping for something better integrated as curved objects for the physics engine. Or maybe I’m just dreaming. [import]uid: 12529 topic_id: 5023 reply_id: 17139[/import]
Physics bodies in Corona must be convex. If you want to create a concave shape, you need to do this by creating multiple convex bodies arranged to create the concave shape you want.
Check out the section on complex body constructionon this page. [import]uid: 1294 topic_id: 5023 reply_id: 17321[/import]
Right…I want to create CONCAVE surfaces (again, like the inside of a pinball machine along the top).
I don’t understand how I would create a concave surface by creating multiple convex bodies. Can you give an example of that?
I also don’t see how a ball interacting with such a concave surface would interact properly if it was made of convex bodies.
Again, think about how to create a circular “ramp” or “tunnel” that you would shoot a round ball into. Any pinball machine has this. You want the ball to smoothly follow the curve of the ramp or tunnel. With a polygon surface, the ball will bounce along the path and not follow it smoothly.
So I’m asking for support of Concave surfaces to be added to Corona. Or maybe somebody else can make a sample Pinball application to show if this is possible with Corona or not. [import]uid: 12529 topic_id: 5023 reply_id: 17355[/import]
In this image:

Each of the polygons (denoted by colour, which is the only reason they’re different colours; the gameplay would occur inside the objects, of course) is convex, but they combine to create the general sort of shape that you might want. This is very over-simplified for the sake of illustration, but the more convex bodies you add to create the outside edge, the smoother the edge will be. You’ll have to experiment to figure out how many polygons is the optimal number - the physics engine in Corona runs pretty well, so you can probably use quite a few, but I don’t know for sure.
This is an option, perhaps your only option for now. I don’t know if Ansca is planning to add support for concave objects to the physics engine, or if that’s even possible - they’d have to comment on that. Even if they can/do, it’s not going to happen overnight, so whether you want to go this route depends on how badly you want to make your game.
Darren [import]uid: 1294 topic_id: 5023 reply_id: 17371[/import]
box2d doesnt support Concave objects. they’d have to include decomposition but personally i’d want to optimize this by hand
http://developer.anscamobile.com/forum/2010/11/03/physics-complex-polygon-tool [import]uid: 6645 topic_id: 5023 reply_id: 17382[/import]
I’m also interested in building a pinball game. I happen to own a copy of Illustrator, so I used bezier curve drawing in Illustrator to create a curved image, then used PhysicsEditor to create the polygons for it. In a test, a ball rolls nicely around the curved shape.
You can download the image and the test program here:
http://www.chirpid.com/home/corona/bezier-exercise.zip
I’m new at all of this, including Illustrator, so this is an experiment. I notice that when you drag the shape, the ball falls through the shape. So even though I’ve set isBullet=true on both objects, and set fps=60, the collision seems to miss when motion starts while the ball is already touching the shape. Could be a problem for flippers. [import]uid: 23636 topic_id: 5023 reply_id: 32486[/import]