Problem with polygon physics body

I have a sprite sheet of a man running, and I have made the physics body a polygon shape. However, now it will not bounce, move or roll or anything, although it is still affected by gravity. Any solutions to this? The code is:

local sheet1 = sprite.newSpriteSheet( "man.png", 150, 200 )
local spriteSet1 = sprite.newSpriteSet(sheet1, 1, 6)
sprite.add( spriteSet1, "running", 1, 6, 300, 0 )

local man = sprite.newSprite( spriteSet1 )
man.x = 100;man.y = 10;man.xScale =.2;man.yScale =.2;man.rotation = 0
man:prepare("running")
man:play()
manshape = {-16,-28, 18,-28, 18,0, 12,0, 12,30, -18,30}
 
physics.addBody(man, {friction = 0.1, density = 1, bounce = 1, shape=manshape})
physics.addBody(bottom, "static", {density = 1, friction = 0.1, bounce = 1})
man.bodyType = "dynamic"

[import]uid: 116264 topic_id: 24254 reply_id: 324254[/import]

It might be because of your physics body shape. It has to be defined in a clockwise order. It looks like yours is counter clockwise.

In all honesty I would give Physics Editor a run:
http://www.physicseditor.de/

I made an entire game by creating my own custom shapes and after I discovered Physics Editor I was kicking myself. It literally takes seconds to define a shape. It is the one tool I would choose over any other for physics based games. You can also try it for free. I didn’t use it at first because I was new and didn’t understand it but there is a sample for Corona now:
http://www.physicseditor.de/2012/01/22/example-with-coronasdk-using-physicseditor-texturepacker/

Hope this helps.
EDIT: I just looked at the documentation for complex bodies and it shows it being created counter clockwise. I remember this causing grief for me before. All my items were definitely created clockwise and they work. It’s been a while but I remember following the samples on that page and it not working properly. [import]uid: 31262 topic_id: 24254 reply_id: 98257[/import]

thanks, ive downloaded it and looks great, although im not sure how I would apply it to a sprite as the outline changes. Ive checked my coordinates and they are definitely in clockwise order.Any other suggestions? [import]uid: 116264 topic_id: 24254 reply_id: 98266[/import]

Sorry Will, I completely missed the whole sprite thing. I can’t comment on that. No experience.

This line here is counter clockwise.

manshape = {-16,-28, 18,-28, 18,0, 12,0, 12,30, -18,30}  

Can you see if replacing with this line works?

manshape = {12,30, 12,0, 18,0, 18,-28, -16,-28, -18,30 }  

The shape seems to be an L shaped block? Am I correct? [import]uid: 31262 topic_id: 24254 reply_id: 98274[/import]

yeah, the shape is a sort of L. Ive changed the order of the coordinates and now corona crashes when I run it? [import]uid: 116264 topic_id: 24254 reply_id: 98282[/import]

I don’t think you can make an L shape. I think you will have to use 2 shapes together to make it. [import]uid: 31262 topic_id: 24254 reply_id: 98283[/import]

Can you try this and see if it works?

manshape1 = {-18,30, 12,30, 12,0, -18,0 }  
manshape2 = {18,0, 18,-28, -16,-28, -16,0 }  
  
physics.addBody(man, {friction = 0.1, density = 1, bounce = 1, shape=manshape1},  
{friction = 0.1, density = 1, bounce = 1, shape=manshape2})  

Again, I don’t have any experience with physics on sprites so not sure if this is accomplishing what you need. [import]uid: 31262 topic_id: 24254 reply_id: 98287[/import]

Ok thanks I will try that and let you know how it goes [import]uid: 116264 topic_id: 24254 reply_id: 98288[/import]

Thanks ive changed the shape and it works! Thanks for your help [import]uid: 116264 topic_id: 24254 reply_id: 98300[/import]

No probs Will [import]uid: 31262 topic_id: 24254 reply_id: 98306[/import]