Help with physic bodies [SOLVED]

I have to be missing something really simple here…

based on the documentation for physics, I believe setLinearVelocity should be used like this:

[lua]local enemyBody = physics.addBody(enemy, “dynamic”, {bounce = 0})
enemyBody:setLinearVelocity( 2, 4 )[/lua]

however, I’m getting runtime errors with line 2. Also getting errors if I try

[lua]enemyBody.angularVelocity = 100[/lua]

any ideas? Oddly enough, the documentation page just jumps from using physics.addBody, to referring to “myBody” without actually showing how “MyBody” is instantiated.

I’m just guessing its myBody = physics.addBody(…) although it doesn’t seem to be addressed directly anywhere [import]uid: 49447 topic_id: 16014 reply_id: 316014[/import]

Try something like this…

[lua]local enemyBody = display.newImageRect( “enemy.png”, imgWidth, imgHeight )
physics.addBody(enemyBody, “dynamic”, {bounce = 0})
enemyBody:setLinearVelocity( 2, 4 )
enemyBody.angularVelocity = 100[/lua]

Gook luck!
[import]uid: 67217 topic_id: 16014 reply_id: 59400[/import]

thanks, I didn’t realize that an imageRect (or in my case, a sprite) was the body just by calling physics.addBody on it.

Wish I would have posted this first, instead of trying a few different daily builds (assuming it was an issue with corona)! lol. [import]uid: 49447 topic_id: 16014 reply_id: 59401[/import]