Problem with angular damping in javascript testbed

General discussion about the R.U.B.E editor
Post Reply
Delta9
Posts: 2
Joined: Wed Apr 17, 2013 4:48 pm

Problem with angular damping in javascript testbed

Post by Delta9 »

Hi iforce2D,

I can't seem to get angular damping to work with scenes running in the javascript testbed, even though it works perfectly in the editor. Is this a known problem/missing feature, or am I just doing something really stupid?

Thanks! :)
iforce2d
Site Admin
Posts: 861
Joined: Sat Dec 22, 2012 7:20 pm

Re: Problem with angular damping in javascript testbed

Post by iforce2d »

Looks like it is missing from the loader... sorry!
You can add this to the loadBodyFromRUBE function:

Code: Select all

var bd = new b2BodyDef(); //after this...
...
// add these:
if ( bodyJso.hasOwnProperty('angularDamping') )
    bd.angularDamping = bodyJso.angularDamping;
if ( bodyJso.hasOwnProperty('linearDamping') )
    bd.linearDamping = bodyJso.linearDamping;
Delta9
Posts: 2
Joined: Wed Apr 17, 2013 4:48 pm

Re: Problem with angular damping in javascript testbed

Post by Delta9 »

Wow, thanks for the quick answer. That did indeed solve it and I feel only slightly stupid :mrgreen:

Thank you also for a great editor, I've been having a lot of fun prototyping with it and would say it's well worth its money.
Post Reply