Hi,
I try to move my player with physics (applyForce/applyLinearImpulse) and the player is also affected by force fields from blowers etc.
Everytime the player hits the ground following funtion is called
[lua]function floorCollision(event)
if(event.phase == “began”) then
player:setLinearVelocity(0, 0)
player:applyLinearImpulse(0.55, -2.5, player.x, player.y)
end
end[/lua]
Everytime the player gets in a force field (invisible sensor) of a blower following code is called:
[lua]function BlowerCollision (Blower, event)
if (event.phase == “began”) then
local forceX = math.cos(Blower.rotation) * 10
local forceY = math.sin(Blower.rotation) * 10
event.other:applyForce(forceX, forceY, Blower.x, Blower.y)
end
end[/lua]
This codes works more or less but the movement is somehow strange. It is very snatchy and sometime the player jumps in the sky without any reason.
Is there a better way to provide realistic and smooth physic behaviour?
Any help is really welcome because this issue is really frustrating. I tried many different settings but nothing seemed to work better. [import]uid: 74852 topic_id: 12649 reply_id: 312649[/import]
[import]uid: 52491 topic_id: 12649 reply_id: 46397[/import]