use of shape in physics.addbody( )

shape attribute is available in physics.addbody()
An example i tried is as follows.
man = “man.png”
shape1= man.x,man.y,man.x+201,man.y,man.x+201,man.y+201,man.x,man.y+201}
physics.addBody(man,“dynamic”,{density = 2,bounce = 0, shape=shape1})
This man object gets separated from all other objects. It dont collide and stop with static objects. Then what is the exact use of this shape attribute??? [import]uid: 85844 topic_id: 14520 reply_id: 314520[/import]

You tried that exact code? If so, yeah, that wont work.

[lua]local man = display.newImage(“man.png”)
shape1= {man.x,man.y,man.x+201,man.y,man.x+201,man.y+201,man.x,man.y+201}
physics.addBody(man,“dynamic”,{density = 2,bounce = 0, shape=shape1})[/lua]

That is the correct way to do things. (Although in this case you would NOT want to use that body.)

See here; http://developer.anscamobile.com/reference/index/physicsaddbody

It allows you to make his physics shape something other than a rectangle or a circle.

For example, you could make his body a triangle shape. It helps with making collision accurate.

Make sense?

Peach :slight_smile:

PS - In order to see the physics body for testing purposes add this line to your code after starting physics;
[lua]physics.setDrawMode ( “hybrid” )[/lua] [import]uid: 52491 topic_id: 14520 reply_id: 53721[/import]