What it is supposed to do:
several visualBodies created in the same horizontal line, must move along this common horizontal line to the right when gravity.x grows and make a stack one close to the next without overlap.
What happens:
when a bodiy moves right it first stacks then, after 3 seconds it pusshes body at its right. Looks like a force grows and forces bodies.
I worked for hours and tried lot of alternatives, unsuccessfully.
Thanks for help anybody.
Leon
Here is my code:
function Cell:newVisualBody(x,y) -- x, y = cell position
visualBody = physics.body(POLYGON,
vec2(0,0),
vec2(cadreWidth,0),
vec2(cadreWidth,cadreHeight),
vec2(0,cadreHeight)
)
visualBody.type=DYNAMIC
visualBody.gravityScale= 100
visualBody.mass = 0.01
visualBody.categories = {5}
visualBody.mask = {5} -- collide with same bodies
visualBody.position = vec2(x,y)
sliderJoint = physics.joint(PRISMATIC, self.body, visualBody
, self.body.position, vec2(1,0))
sliderJoint.enableLimit = true
sliderJoint.upperLimit = 50
sliderJoint.lowerLimit = 1
sliderJoint.enableMotor = true
sliderJoint.maxMotorForce = 0
return visualBody
end -- function newVisualBody()