Changing distance joint length slow

I’m wondering why this joint length transition is so slow. It should take 100 ms but is taking about 2000 ms instead. 

Full code:

local physics = require( "physics" ) physics.start() local staticBox = display.newRect(100, 100, 100, 100) physics.addBody(staticBox, "static") local hero = display.newRect(100, display.contentHeight - 100, 50, 50 ) physics.addBody(hero, "dynamic") local joint = physics.newJoint( "distance", staticBox, hero, staticBox.x, staticBox.y, hero.x, hero.y ) physics.setDrawMode( "hybrid" ) transition.to(joint, {length = 100, time = 100})

Hi @jonjonsson,

In my experience, the “length” of distance joints doesn’t just reflect itself instantly (or even quickly) if you change it. It’s probably better if you also transition the bodies in sync with the joint translation so that, when both transitions are done, the bodeis are approximately 100 pixels apart (or whatever length you want to set). That may take a little trig math to calculate, but it shouldn’t be too difficult.

Brent

Hi @jonjonsson,

In my experience, the “length” of distance joints doesn’t just reflect itself instantly (or even quickly) if you change it. It’s probably better if you also transition the bodies in sync with the joint translation so that, when both transitions are done, the bodeis are approximately 100 pixels apart (or whatever length you want to set). That may take a little trig math to calculate, but it shouldn’t be too difficult.

Brent