physics.addBody defaults

The manual states that each property in the table passed to physics.addBody has a default value (e.g., density has a default value of 1.0), but what does this actually mean? I assumed that it meant I could leave certain properties out and they’d be automatically assigned their default values. For example…

physics.addBody(ball, { } )

…should give ball a density of 1.0, right? But it doesn’t. If I don’t explicitly set the density to 1.0, ball goes flying off the screen at the slightest touch, as though it has a density of 0. Same goes for the other properties (friction & bounce are 0 unless I explicitly set them in addBody). Is this normal? And if it is, in what sense do these properties have default values? [import]uid: 10327 topic_id: 3459 reply_id: 303459[/import]

*Bump*

Nobody? [import]uid: 10327 topic_id: 3459 reply_id: 10679[/import]

density = 0 would stop it moving entirely wouldn’t? that’s what i use in Box2D anyway

have you tried

print(tostring(mySprite.density))
print(tostring(mySprite.body.density))

i’m not sure which
j

[import]uid: 6645 topic_id: 3459 reply_id: 10680[/import]

jmp909,

I get ‘nil’ for ball.density, ball.bounce, and ball.friction, regardless of whether I give these properties an initial value in addBody, so I guess Corona doesn’t expose physics properties this way (although it would be kind of handy if it did, even if they were read-only…). [import]uid: 10327 topic_id: 3459 reply_id: 10684[/import]