Bug in javascript loader
Posted: Wed Nov 30, 2016 3:51 pm
I found a small bug in your javascript loader while I was digging through it.
https://www.iforce2d.net/rube/loaders/javascript/
I borrowed code from that demo player for my own project and came across an error I needed to correct for the weld joint to work properly.
It's on line 219 of https://www.iforce2d.net/rube/loaders/j ... oadrube.js
Where it loads weld joints it says:
While all other joints have different code for loading the reference angle:
As you can see it checks for the referenceAngle property on the weld joint but checks the refAngle property on all other joints. This causes weld joints not to load at their correct angles, and they both bodies will be kept at the same rotation rather than the same orientation as intended. Pretty sure this was not intentional because in the C++ loader the weld joint uses refAngle to load like all the other joints.
I figured this might save someone a minute or two in the future if I posted it here
https://www.iforce2d.net/rube/loaders/javascript/
I borrowed code from that demo player for my own project and came across an error I needed to correct for the weld joint to work properly.
It's on line 219 of https://www.iforce2d.net/rube/loaders/j ... oadrube.js
Where it loads weld joints it says:
Code: Select all
if ( jointJso.hasOwnProperty('referenceAngle') )
jd.referenceAngle = jointJso.referenceAngle;
Code: Select all
if ( jointJso.hasOwnProperty('refAngle') )
jd.referenceAngle = jointJso.refAngle;
I figured this might save someone a minute or two in the future if I posted it here