Hi @Brent Sorrentino
That’s what I meant.
I did a simple test. The result is more or less what I want but I do not know if the code is optimized.
Could you give me an opinion?
local physics = require("physics") physics.start() physics.setDrawMode( "hybrid" ) --debug hybrid normal local bodiesGroup = display.newGroup() -- Create physical objects local shape = display.newRect( bodiesGroup, 0, 0, 60, 60 ) shape:setFillColor( 1, 0.2, 0.4 ) physics.addBody( shape, "dynamic", { bounce=0 } ) shape.x, shape.y = display.contentCenterX, 300 touchPoint = display.newCircle( bodiesGroup, 0, 0, 15 ) touchPoint:setFillColor( 1,0,0.2 ) touchPoint.alpha = 0 shape:toBack() touchPoint:toBack() -- Create joint joint = physics.newJoint( "touch", shape, shape.x, shape.y ) joint.maxForce = 1000 joint.frequency = 0.8 joint.dampingRatio = 1 --temp obj for joint local tmp = display.newCircle( bodiesGroup, shape.x, shape.y, 20 ) tmp.isVisible = false transition.to(tmp, {time = 2000, x = display.contentCenterX+100}) transition.to(tmp, {delay = 2000, time = 2000, y = 200}) transition.to(tmp, {delay = 4000, time = 2000, x = display.contentCenterX-100}) transition.to(tmp, {delay = 6000, time = 2000, y = 300}) --Function to follow the object from the joint function mima() joint:setTarget( tmp.x, tmp.y ) end Runtime:addEventListener( "enterFrame", mima )