[quote=“torbenratzlaff,post:3,topic:317598”]
You have to set the .isSleepingAllowed property for the circles.
Dynamic bodies are send to sleep after a while of rest, so they take less memory. But that can be really annoying on the other hand.
myCircle.isSleepingAllowed = false
http://docs.coronalabs.com/api/type/Body/isSleepingAllowed.html
Greetings Torben [/quote]
Here is my code. But isSleepingAllowed flag is the thing I needed. Thank you very much guys!
local physics = require("physics"); physics.start(); physics.setGravity(0, 9.81); physics.setDrawMode("hybrid"); local \_DCW05 = display.contentWidth/2; local circle = display.newCircle( \_DCW05, 10, 50 ); physics.addBody(circle, {radius = 50}); circle.isSleepingAllowed = false; local groundShape = {-50,-50, 50,-50, 50,50, -50,50}; local ground = display.newRect( \_DCW05, 300, 100, 100 ); ground:setReferencePoint(display.CenterReferencePoint); ground.x = \_DCW05; physics.addBody(ground, "static", {shape = groundShape}); function ground:touch( event ) if event.phase == "began" then self.markX = self.x elseif event.phase == "moved" then local x = (event.x - event.xStart) + self.markX self.x = x; end return true end ground:addEventListener("touch", ground);