Raggar Posted April 12, 2017 Share Posted April 12, 2017 This is a (sort of) port of the Three.js vehicle demo using Cannon.js, in case someone is looking for vehicle physics or just want to play with it. I made some weird choices like sperating the renderLoop and the postStep, and some quesswork here and there. And some options are left out, but can easily be added by looking at the Cannon.js docs or logging the vehicle object itself. This includes ConnectionPoints, which wheels steer, back or front wheels etc. Just play with the options, and press the "Run with Options" in the bottom of the Dat.GUI. http://www.babylonjs-playground.com/#1PX171#9 WASD to drive around. Space to brake. nodejs, Orphevs, BitOfGold and 2 others 5 Quote Link to comment Share on other sites More sharing options...
Raggar Posted April 13, 2017 Author Share Posted April 13, 2017 A few additional parameter have been added. You can now change the height, width and length of the vehicle body, the radius of the tires/wheel, the distance between front and back wheels as well as the horizontal distance, which wheels to brake on(rear, front all 4), which wheels to steer with(same) and which wheels to apply forces to(same). The button is now called 'CREATE' and is at the top of the gui. Press H to hide the dat.gui element. http://www.babylonjs-playground.com/#1PX171#17 And a bus: http://www.babylonjs-playground.com/#1PX171#20 More wheels could easily be added to create a proper truck. BitOfGold 1 Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted April 13, 2017 Share Posted April 13, 2017 really cool Quote Link to comment Share on other sites More sharing options...
Spankied Posted May 3, 2017 Share Posted May 3, 2017 wat he said Quote Link to comment Share on other sites More sharing options...
Raggar Posted May 3, 2017 Author Share Posted May 3, 2017 Whups. One thing I forgot to add to the playground version is the mass. Mass is absolutely critical if you want more life-like physics and handling. High mass and Very high force. It's about finding the right spot before Cannon loses performance. Here's 250 mass instead of 1: http://www.babylonjs-playground.com/#1PX171#23 nodejs 1 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.