Kinematic moving platforms collision issue

Hi all, I am trying to implement kinematic rotating platforms in my game (see example below - run as an iPad view with Corona standard config). I am getting a strange behaviour from the physics whenever a round dynamic body object falls onto these platforms. In summary, upon contact, the platform will “drag” the object (that sticks to the platform and slowly slides on it) and at some point the object will be pushed away at a very high speed. I seem to have the same problem with platforms that move in a diagonal and platforms that move in the same direction as the object. Platforms are defined as rectangles so I do not think that there is a clock wise/counter clock wise definition issue. Any idea of what is going on? Is it possible that Box2D is not working out collision properly when a kinematic body changes X and Y position at each frame?

[code]



– main.lua


local physics = require(“physics”)
physics.start()

local ball
local windmill1
local objects = display.newGroup()

– Windmill “constructor”

local function drawWindmill(x, y, r, angle, dir, speed)
local windmillPhysics = {density = 10, bounce = 0.3, friction = 1}
local spokeLength = 2 * r
local spokeHeight = 15
local windmill = {}
local spoke1 = display.newRect (x-r,y-spokeHeight/2,spokeLength, spokeHeight)
local spoke2 = display.newRect (x-spokeHeight/2, y-r, spokeHeight, spokeLength)
spoke1:setFillColor(200, 200, 200)
spoke2:setFillColor(200, 200, 200)
physics.addBody(spoke1, “kinematic”, windmillPhysics)
physics.addBody(spoke2, “kinematic”, windmillPhysics)
spoke1:rotate(angle)
spoke2:rotate(angle)
windmill.id = “windmill”
windmill.dir = dir
windmill.angle = angle
windmill.speed = speed
return windmill, spoke1, spoke2
end

– Ball

local ball = display.newCircle(375, 10, 30)
physics.addBody(ball, {density = 10, bounce = 0.3, radius = 30 , friction = 0.3})
objects:insert(ball)

– Windmill 1

windmill1, w1spoke1, w1spoke2 = drawWindmill(375, 700, 100, 30, -1, 1)
objects:insert(w1spoke1)
objects:insert(w1spoke2)

– ENTER FRAME LISTENER

function onEnterFrame()
w1spoke1:rotate(windmill1.dir * windmill1.speed)
w1spoke2:rotate(windmill1.dir * windmill1.speed)
end

Runtime:addEventListener(“enterFrame”, onEnterFrame)

[/code] [import]uid: 159908 topic_id: 31135 reply_id: 331135[/import]