altreality Posted March 25, 2016 Share Posted March 25, 2016 HI, I am moving trains on a track in a callback registered with scene.registerBeforeRender() I need the time delta since the last call before I can update the train position. How do I get the dt ? Thanks. Quote Link to comment Share on other sites More sharing options...
jerome Posted March 25, 2016 Share Posted March 25, 2016 http://doc.babylonjs.com/classes/2.3/Engine#getdeltatime-rarr-number Quote Link to comment Share on other sites More sharing options...
altreality Posted March 25, 2016 Author Share Posted March 25, 2016 Thanks Jerome. I assume its in milliseconds? http://synth2014.github.io/Age-of-Steam/babylon/rk4.html The time delta seems to vary noticeably - maybe if many tabs are open. Is there any way to smoothen out the time step somehow? Quote Link to comment Share on other sites More sharing options...
Wingnut Posted March 25, 2016 Share Posted March 25, 2016 Hey AltReality... good to see you again! Sorry to interrupt, but I did lots of experiments on train wheels since we last spoke. Unfortunately, many went dead because I bypassed the physics plugin and then OimoJS got updated (and so did CannonJS). But Raanan... God of physics... got one of those demos... working again: http://www.babylonjs-playground.com/#1ND6TH Yay! (Deltakosh helped with part of it, too. In fact, he completely enabled it to happen.) It still has some wheel wobble, but, by mid-summer... I will have great-working train wheel physics... ready to donate to your Age of Steam project (if you allow it). At minimum, I will have a few more demos, using the new physics interface (which you can see SOME-of... in that playground - thanks Raanan), and you can borrow code from them, if wanted. I want to get the wheels as accurate as possible... actually applying impulse to the diaphragm inside the air cylinders... to drive the wheels. I got as far as TWO wheels with studs on the sides, and single crossbar connecting the two studs. All of the joints (6 total) wobbled a bit, but the energy was transferred from one wheel to the other... perfectly, through the crossbar. (it worked somewhat correctly). Raanan just released the initial "new docs" for the new physics interface. http://www.html5gamedevs.com/topic/20723-the-new-physics-engine-architecture/?do=findComment&comment=121598 A tip-of-the-hat to Temechon and friends, too. I believe he was "team leader" on our first/initial physics interface, which got us all rolling and bouncing, first. Thanks T. Maybe Gwenael and Davrous and Deltakosh and Dad72, too. BJS founding fathers... gotta love 'em! Davrous's physics tutorial kept us alive thru the dark ages. It was the only doc in town (other than DK's initial introduction to physics)... for a LONG time. These docs saved my life many times... and Raanan now carries-on that tradition (of saving my life). heh Ok, back to delta time... sorry for the interruption. Go trains! RaananW 1 Quote Link to comment Share on other sites More sharing options...
altreality Posted March 26, 2016 Author Share Posted March 26, 2016 Hey Wingnut Wow that looks awesome. Shaping upto a major rail engineering demo! So whats stopping us from adding another wheel and connecting them via the connecting/coupling rod : Quote Link to comment Share on other sites More sharing options...
altreality Posted March 26, 2016 Author Share Posted March 26, 2016 Ok got them connected: http://www.babylonjs-playground.com/#1ND6TH#4 Just duplicated everything. Not sure why the stud positions with respect to parent have to be different: stud1.position = new BABYLON.Vector3(7, 3, 0); stud2.position = new BABYLON.Vector3(7, -3, 0); Wingnut and RaananW 2 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.