Smek Posted November 16, 2016 Share Posted November 16, 2016 Hello all, I just started experimenting with the great Babylon framework. I am trying to mimic pallets (1.2 * 1.6 * 0.8 m, 1000 kg) running on a conveyor belt behaviour by setting a linearVelocity to an object without mass which then acts as the conveyor. See this demo: http://www.babylonjs-playground.com/#11KWUR#7 But i am running into a problem, related to the velocity. I am setting a velocity of 0.25 m/s (line 53) and the "conveyor" is 10 meters long (line 46). This means it should take about 40 seconds to cover that distance. But as you can see from the demo the speed is approximatly 1 m/s since it only takes 10 seconds to cover the distance. The issue is not related to friction, to illustrate I have added an other 'pallet' with low friction. Can somebody explain the behaviour to me? And how can I fix this? Thanks in advance! Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted November 16, 2016 Share Posted November 16, 2016 Weird One option could be to set the time step to a lower value: http://www.babylonjs-playground.com/#11KWUR#8 Adding @RaananW RaananW 1 Quote Link to comment Share on other sites More sharing options...
RaananW Posted November 17, 2016 Share Posted November 17, 2016 Hi @Smek, you had me at "the great Babylon framework". This is rather werid, yes. I have to say - the timestep solution is the quickest and the safest for you to simulate the right behavior. As babylon only acts as a proxy to the real physics engine (which, in this case, is cannon.js), it will be wise to see what cannon is actually doing with the information. I will try finding a bit of time later today and debug this a bit, see what we are doing wrong. Quote Link to comment Share on other sites More sharing options...
Smek Posted November 17, 2016 Author Share Posted November 17, 2016 I looked at it some more, for some reason the real velocity is a factor 0.33 compared to the real thing. I fixed it (for now) by setting the time step to 1/180 instead of 1/60 and the gravity to 3 times -9.81. But I think this is something to look at since users are probably expecting the same units as both physics engines use. RaananW 1 Quote Link to comment Share on other sites More sharing options...
Smek Posted November 20, 2016 Author Share Posted November 20, 2016 Found the actual problem, Babylon is calling 3 substeps in this line: this.world.step(this._fixedTimeStep, this._useDeltaForWorldStep ? delta * 1000 : 0, 3); This causes the problem. Wingnut 1 Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted November 21, 2016 Share Posted November 21, 2016 Good catch! 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.