Theo Lee

What breaking changes were there from v2.4 to v2.5 regarding Physics?

Recommended Posts

This question may be a little daft... But what breaking changes were made from BabylonJS 2.4 to 2.5 regarding physics? https://github.com/BabylonJS/Babylon.js/releases/tag/v2.5.0 does not seem to mention it.

This is because http://www.babylonjs-playground.com/#1PVBTF#6 from https://blog.raananweber.com/2016/09/06/webgl-car-physics-using-babylon-js-and-oimo-js/ back in 2016 used BabylonJS 2.4 (from 2016), but now the playground no longer works.

I have downloaded and playground and swapped the BabylonJS version to 2.4 (and the corresponding Oimo.js version) on my computer and it works then. Upping the version to 2.5 breaks it. May I know what changes may have caused these (and maybe how to modify the code to work with the new versions of BabylonJS)? Thank you!

Share this post


Link to post
Share on other sites

Hi again, Theo Lee, sorry for the slow replies.

I started SOME work on this... https://www.babylonjs-playground.com/#1PVBTF#74

As you likely know, arrow keys left/right for steering (works)... and arrow keys up/down for driving (fails).

The executeWhenReady() func at line 383... should start rolling all 4 wheels... slowly forward, at load-finish time.

It doesn't.  It's broken.  I'll try to put some more time into helping with this.  SOMETHING happened in BJS 2.5 release, and it apparently has carried-thru to current versions.  Thx for the troubleshooting you did, Theo Lee... testing 2.4 vs. 2.5 on home system.  Helpful.

Does anyone know if I can (and how-to) read the 2.5 "What's New" document?  Still available?  Anyone know any other GitHub-ish searches/filters... to help see what changed in 2.5?  Thx.

Share this post


Link to post
Share on other sites

Updates:  Hi!  Nothing pertinent seen in "What's New".

New, cleaner PG:  https://www.babylonjs-playground.com/#1PVBTF#75

Detached arc-cam this time.

Some odd tests were done... like those seen in lines 199/200, changing from hinge joint to motor-enabled hinge joint (just a different way of constructing).  But likely, hinge joints are motor-enabled by default.  This PG (its up/down arrows) once worked (BJS 2.4-).  There's no real reason to be suspicious of joint constructor methods.  Wingnut was "grasping at straws"  (wasted testing).

A camera slow-pan is available at lines 359 & 360.

You don't need to use up/down arrows.  Motor for joint1 IS activated automatically  (in theory), via lines 364-375.

You can activate line 361 to see joint1's limitMotor angle ... streaming on the console.

In my opinion, rollJoint1._physicsJoint.limitMotor.angle is changing MUCH too slowly.  

The wheel MIGHT BE rolling... just... micro-amounts. 

Normal up/down arrow keys produce motor speeds of approx. 31 and -31.  I set my auto-motor speed at 80, much faster than up/down arrow keys.

Still, slow slow angle changes.  hmm.  *shrug*  Still learning/testing.  Party on!   Help welcome, as always.

Update:  Another broken-in-Oimo playground - paddle wheel thing:  https://playground.babylonjs.com/#5W5B6W#6   Maybe the Oimo motor is rusted?  Maybe some WD-40?  :)

Share this post


Link to post
Share on other sites

Latest:  https://www.babylonjs-playground.com/#1PVBTF#80

(yawn).  For those lost, please back-read.  This is a thread about troubleshooting a setMotor() issue in the Oimo physics engine or plugin.  The issue appears to have been introduced in BabylonJS 2.5.

For this PG, I "localized" the entire Oimo plugin... to make it easier for me to do tests.  So far, I see no issues with the plugin.

I wonder if we changed Oimo versions... between BJS 2.4 and 2.5.  Anyone know?

Back to the PG, I decided to determine WHY the physics motors on the steering... were working, but not the motors that roll the wheels.

So, I disabled the setMotors() on the steering (it's on the "holders", to be specific... a little box near each wheel).   I disabled lines 739/740.

OMG, left/right-arrow steering STILL WORKS!   Apparently the "setLimit" lines 731/732 are doing some turning, even without any setMotor() calls.

Interesting!  Ok, maybe not.  :)

Other testing happening in renderLoop lines 772-784... repeatedly TRYING to "brute force" the physics motors to run, via native-level pokes.  No go.

In my opinion, there IS still a chance that this issue is caused by BJS itself... and not inside the plugin.  Activate line 797 to see wheel1 roll fine.  But just because I can roll it with setting angularVelocity... doesn't mean that BJS system isn't preventing the wheel from spinning.... when driven by a joint motor.

De-activate line 797, again, and activate line 764, to watch the motor angle streaming to the console.  See how it is "micro-moving"?  The caused-by-BJS theory... somewhat explains this.  The motor is TRYING to rotate it's "shape2", but BJS won't let it, because the shape-mesh has been frozen in place... by something in BJS itself.

We must first try to determine if a different version of Oimo... was used in BJS 2.5 (as compared to BJS 2.4).

And there's one other thing.  The motors work fine in CannonJS... using the CannonJS plugin... in BJS 2.5+.  So even if it IS a BJS-caused issue, it is ONLY affecting Oimo's method of setMotor, and not Cannon.  The setMotor plugin code for each... could be drastically different.  I have not yet compared Oimo's setMotor code... to Cannon's setMotor code... to see how they differ.  Studies and learning continue. 

Not a very exciting adventure, is it?  *nod*  I pretend that if I find the reason for the issue, I "get the girl".  :D  That keeps me motivated.  The hero ALWAYS gets the girl... unless it's a girl hero... unless... well, you know.

Share this post


Link to post
Share on other sites

Thanks @Wingnut! So I have just attempted to convert all to Cannon.JS... However the lack of slider joints has me stumped... May you please take look at this playground and help me?
https://www.babylonjs-playground.com/indexStable.html#1PVBTF#85
I've modified the masses a little, changed the physics engine to Cannon and attempted to substitute the slider joints... But I must be doing it wrong since my joints go crazy and my steering is completely broken... 😐

Thanks!

Share this post


Link to post
Share on other sites

Hi T!  I was SO hoping that @RaananW would have visited and saved the day (Oimo-wise).  hmm.

A sliderJoint might simply have a different name... in Cannon... like perhaps distanceJoint.  Most of the properties are differently named... for each engine, unfortunately.  Conversion to CannonJS == big step.  Destined for troubles.

You have visited R's tutorial page, yes?  https://blog.raananweber.com/2016/09/06/webgl-car-physics-using-babylon-js-and-oimo-js/

Are you a member of the new BJS forum?  I hope so.

Really, some physics superstar needs to build (us) NEW, FRESH versions of "basic car"... for all three of our plugin-honored physics engines.  (Oimo, Cannon, Ammo) 

Who?  I don't know.  I'm really not very good-at physics coding, but only a few people... ARE.  I think the corporate world is sucking-up the pro's, so they don't have time to hang-around with us, here.  :)

*sigh*  I DO have time to work-on fixing the Oimo car or helping with a Cannon car, but, to be frank, doing that isn't much fun.  I'm sort-of retired... so I screw-off a lot and don't like getting stressed.  Hmm.  I will give it some thought.  You... have been very brave... attempting to convert the Oimo car... to Cannon.  Bravo!  You might get a brain tumor, though.  :D

Maybe there are others nearby that can give quicker/better answers than I.

Join the other forum, and in a few days, perhaps visit "The Wingnut Chronicles" and say something like... "Theo here... let's talk about physics cars".  I will probably *sigh* again... knowing the amount of "work" it could entail.

Me, I want to try to determine WHY Oimo joint setMotor is failing, or, more precisely, why the impostor attached to one end of that joint... is frozen in-place.  Remember we saw the "micro-moving" in a previous playground.  That micro-moving of the setMotor... is evidence that the motor is TRYING to work, but POSSIBLY... the impostor's shape (the mesh) is refusing to allow it.  More precisely, I believe it is the shape's "transformNode" that is causing setMotor to fail.  Mesh transformNodes are a fairly new feature, and are still under consistent development.

I think... something was modified in transformNode... and the Oimo plugin was not updated to compensate for that change.  Raanan could probably find it in less than a day.  Wingnut... around 2 months.  :o  So, you see why I *sigh*.  :D  

But still, getting good-working basic physics cars... is important, and worthwhile.  I will TRY to keep pursuing that goal.  Cya at the new forum.  Our previous posts are safe, here, for at least 90 more days.  But after the new year, we cannot post here any longer.  We can still read, though.  Take care, thanks for the comments, cya soon.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.