Physics Linear Damping has changed behaviour since ( build 2275 )

Updated to latest build noticed the characters in my game are moving at higher speeds

Did a test case and in fact the linear damping behaviour has changed and reaches a terminal velocity at higher velocity than in build 2275  (this change may have occurred in an earlier build than 2332) 

Update: build 2014.2281 and up changes the behaviour of linearDamping

–Run this sample in the simulator you will notice different values in builds 2014.2332  vs  2014.2275
– in 2014.2275  velocity caps at 100  (2.2 seconds to reach destination) (125 if fps is set to 60 in config.lua)
– in 2014.2332  velocity caps at 150  (1.5 seconds to reach destination)

require “physics”
physics.start()
physics.setGravity(0,0)
physics.getMKS( “linearSleepTolerance”  ) … " angularSleepTolerance " … physics.getMKS( “angularSleepTolerance”  ) … " "  )
local centerX, centerY = display.contentCenterX, display.contentCenterY

local circle = display.newCircle(centerX-100,centerY,30)
physics.addBody(circle,“dynamic”)
circle.linearDamping = 10

local start = display.newRect( centerX-100,centerY, 2, 50 )
local finish = display.newRect( centerX+100,centerY, 2, 50 )
local stat = display.newText( {text=“hello”,x=centerX,y=centerY+50,fontSize=30})

local function speedTest(event)
   if(circle.x  <  finish.x) then
     circle:applyForce( 2, 0,circle.x,circle.y)
     local velX,velY = circle:getLinearVelocity()
     stat.text = "t " … math.round(event.time) … " v " … math.round(velX)
   else
     circle:setLinearVelocity( 0, 0)
   end
end

Runtime:addEventListener(“enterFrame”, speedTest)

I tracked this change to  CoronaSDK 2014.2281 all builds before that the linearDamping behaves like it has for the past 2 years since I’ve been using it (at least from what I’ve noticed)

If you use linear damping at all in any project it can seriously impact your game by using the newer builds and you’ll have to rig new values to get things back to normal

I met the same problem.

Thanks for bringing this issue to our attention. I’ve investigated its cause, and found that the author of Box2D (Erin Catto) changed the damping behavior as a response to a bug report.

Please see the modification made in b2Island.cpp here:

https://code.google.com/p/box2d/source/detail?r=263

Since we strive to stay current with the latest Box2D changes, we believe we should preserve this change.

You guys need to publicize these changes, it’s not even in the dailybuilds notes.  Maintenance changes apparently means anything nowadays. Very unproffesional

We’re sorry this change passed unnoticed. Thanks for catching it.

See thread here:

http://forums.coronalabs.com/topic/48232-release-notes-recently-have-been-very-vague/?hl=maintenance

I agree - there needs to be more transparency. 

on the bad side:  a potential breaking change for many carefully tuned physics puzzlers

on the plus side:  suggests we’re getting an updated box2d core

fortunately both old/new formulae are linear (if we ignore the potential clamping in old formula w ‘goofy’ damping values), so Catto’s (paraphrased) assertion is that 1-hd ~= 1/(1+hd), which can be made a true equality if we introduce a correction term, then solve.

I’ll spare you the math, but given an old damping factor (note that linear and angular work exactly the same, so doesn’t matter which), here’s the new value you’d need with new equation to get ~=same results as with old damping value/old damping equation

newd = oldd / (1 - h \* oldd) -- where h is your timestep, fe 1/60

…to a reasonable approximation, given that you might not be using a fixed time step.

fe, if velocity = 3 and damping = 1, under old formula, first time step would yield velocity = 2.95

under new formula, with original damping value, first time step would yield 2.9508196721…  (didn’t slow it quite as much, as OP cites)

the corrected new damping would be:  1/(1-1/60*1) = 1.01694915…

under new formula, with corrected damping value, first time step yields:  2.95 (matching old)

i can’t actually test this since i don’t have access to daily builds, but the math itself checks and double-checks, so… fwiw, ymmv

@albert90, Will you fix this problem?  otherwise I will modify my code.

@pickerel: The current behavior will stay as-is, as to stay current with the latest Box2D changes. So I recommend you update your code. I apologize for the inconvenience.

I tracked this change to  CoronaSDK 2014.2281 all builds before that the linearDamping behaves like it has for the past 2 years since I’ve been using it (at least from what I’ve noticed)

If you use linear damping at all in any project it can seriously impact your game by using the newer builds and you’ll have to rig new values to get things back to normal

I met the same problem.

Thanks for bringing this issue to our attention. I’ve investigated its cause, and found that the author of Box2D (Erin Catto) changed the damping behavior as a response to a bug report.

Please see the modification made in b2Island.cpp here:

https://code.google.com/p/box2d/source/detail?r=263

Since we strive to stay current with the latest Box2D changes, we believe we should preserve this change.

You guys need to publicize these changes, it’s not even in the dailybuilds notes.  Maintenance changes apparently means anything nowadays. Very unproffesional

We’re sorry this change passed unnoticed. Thanks for catching it.

See thread here:

http://forums.coronalabs.com/topic/48232-release-notes-recently-have-been-very-vague/?hl=maintenance

I agree - there needs to be more transparency. 

on the bad side:  a potential breaking change for many carefully tuned physics puzzlers

on the plus side:  suggests we’re getting an updated box2d core

fortunately both old/new formulae are linear (if we ignore the potential clamping in old formula w ‘goofy’ damping values), so Catto’s (paraphrased) assertion is that 1-hd ~= 1/(1+hd), which can be made a true equality if we introduce a correction term, then solve.

I’ll spare you the math, but given an old damping factor (note that linear and angular work exactly the same, so doesn’t matter which), here’s the new value you’d need with new equation to get ~=same results as with old damping value/old damping equation

newd = oldd / (1 - h \* oldd) -- where h is your timestep, fe 1/60

…to a reasonable approximation, given that you might not be using a fixed time step.

fe, if velocity = 3 and damping = 1, under old formula, first time step would yield velocity = 2.95

under new formula, with original damping value, first time step would yield 2.9508196721…  (didn’t slow it quite as much, as OP cites)

the corrected new damping would be:  1/(1-1/60*1) = 1.01694915…

under new formula, with corrected damping value, first time step yields:  2.95 (matching old)

i can’t actually test this since i don’t have access to daily builds, but the math itself checks and double-checks, so… fwiw, ymmv

@albert90, Will you fix this problem?  otherwise I will modify my code.

@pickerel: The current behavior will stay as-is, as to stay current with the latest Box2D changes. So I recommend you update your code. I apologize for the inconvenience.