[resolved] Box2D problem, changing x,y properties of bodies

I have a small circle (player) rotating around a bigger circle. All I want to do is “shoot” the player in the direction he/she is facing. I calculate the vector between the 2 circles and apply a linear impulse.

It’s just not working. The vector math is fine so I guess it’s a Box2D related problem (I change the players x,y coords using sine and cosine). Just see for yourself.

Code on pastebin

I very much appreciate your help. Thanks :slight_smile: [import]uid: 145963 topic_id: 26234 reply_id: 326234[/import]

add this
[lua]local function onTouch( event )
if not player.isFlying and event.phase == “began” then
player.isFlying = true
local vectorX = player.x - circle.x
local vectorY = player.y - circle.y
local normVectorX, normVectorY = normalize( vectorX, vectorY )
player:setLinearVelocity( 0, 0 ) -------add this
player:applyLinearImpulse( normVectorX, normVectorY, player.x, player.y )
end
end[/lua] [import]uid: 58777 topic_id: 26234 reply_id: 106410[/import]