RaananW Posted February 23, 2016 Share Posted February 23, 2016 So! I don't know how many of you have noticed the commit from yesterday, but Babylon's physics engine has a new architecture. There is now a physics impostor class that will be your one-stop-shop for all physics needs. Applying impulse, force, changing velocity, everything is there. There is also a way to register callbacks to be called before and after the physics step and when the mesh collides against other meshes. Those API might change a bit until 2.4 is officially out, but get used to the new architecture! What's new? A lot! A short list (before I finish writing the full documentation and tutorials): Dedicated PhysicsImpostor for each mesh, dedicated PhysicsJoint for each joint/constraint New Joint-System - Is is now possible to add many kinds of links (depends on the underlying physics plugin) - A Distance Joint, A Hinge, a Ball-And-Socket and more. Documentation is being written But just to get people interested - @Wingnut, you might find this a lot of fun - http://www.babylonjs-playground.com/#1ND6TH Physics plugin is mainly transparent - changing from cannon to oimo (and soon to the new energy engine) should simply work. Try it in the last playground example. Having said that - there is a way to execute native cannon/oimo code in a very simple way New callback mechanism for before and after the physics step AND when an impostor collides against a specific impostor. Two-Way transformation update - No need to execute updatePhysicsBody[Position]() - physics rotation and position is automatically updated. A way to recreate the body, in case parameters like the scale has changed. Physics Plugins rebuilt with performance adjustments. Set Velocity Apply Force And many many other little things For those who want to see what was done under the hood, the PR is here - https://github.com/BabylonJS/Babylon.js/pull/983 Fell free to ask questions, and please wait patiently for the documentation that will arrive soon. (Or "sooner or later"). There are a lot of things on my TODO list to add to this engine (Spring objects, Physics-Particle-System, further joints and constraints and more), but this is step 1. And it is finally done Enjoy physics! Dad72, iiceman, jerome and 6 others 9 Quote Link to comment Share on other sites More sharing options...
jerome Posted February 23, 2016 Share Posted February 23, 2016 Hugissimo !!! Quote Link to comment Share on other sites More sharing options...
Dal Posted February 23, 2016 Share Posted February 23, 2016 This is awesome! I was just having some issues with the old system, so this is a breath of fresh air for me Quote Link to comment Share on other sites More sharing options...
Dad72 Posted February 23, 2016 Share Posted February 23, 2016 huge working on this new system. thank you. Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted February 23, 2016 Share Posted February 23, 2016 Did you say documentation?? Temechon 1 Quote Link to comment Share on other sites More sharing options...
Grag Posted February 23, 2016 Share Posted February 23, 2016 "Long time lurker. finally signed up" Oh my - Babylonjs Just keeps to amaze me. This is great news! All respect to cannon/oimo. Cant wait to get some energy tetherball going. GameMonetize and RaananW 2 Quote Link to comment Share on other sites More sharing options...
RaananW Posted February 23, 2016 Author Share Posted February 23, 2016 Documentation? I don't recall saying that. I never use such words. GameMonetize 1 Quote Link to comment Share on other sites More sharing options...
Wingnut Posted February 24, 2016 Share Posted February 24, 2016 Thanks Raanan! Man, is it fast (with Cannon). Much slower with Oimo, for me. Did anyone else test the demo with Oimo? Please report, thx. Raanan, will you be attempting backwards-compat? (Wingy notices a tiny water puddle under a frozen API) Global warming? Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted February 24, 2016 Share Posted February 24, 2016 it should be backward compatible actually. Did you find a scene which is no more working? Quote Link to comment Share on other sites More sharing options...
RaananW Posted February 24, 2016 Author Share Posted February 24, 2016 @Wingnut - I did my best to keep everything backwards-compatible. If something is not working i would love to know in order to fix it. Oimo was not changed, Cannon didn't either. The only thing that changed was the Babylon architecture. A bit of performance issues were fixed, but nothing that will really be noticeable on a normal computer. Having said that - My new favorite is Cannon.js for implementing complex physics scenes. The newest version is wonderful. Oimo's newest version is not working correctly for some reason. When I find out why I will upgrade to the newest Oimo as well. ian 1 Quote Link to comment Share on other sites More sharing options...
webGLmmk Posted March 5, 2016 Share Posted March 5, 2016 On 2/23/2016 at 10:56 AM, RaananW said: Documentation? I don't recall saying that. I never use such words. PLEASSSEEE?????? with emphasis spanning the length of the universe please do documentation. Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted March 5, 2016 Share Posted March 5, 2016 We will for sure Quote Link to comment Share on other sites More sharing options...
RaananW Posted March 5, 2016 Author Share Posted March 5, 2016 Sorry again ☺ I'll work on it as soon as possible. I just keep on adding new features... Quote Link to comment Share on other sites More sharing options...
Pryme8 Posted March 10, 2016 Share Posted March 10, 2016 On 2/23/2016 at 1:13 AM, RaananW said: and more. Documentation is being written But just to get people interested - @Wingnut, you might find this a lot of fun - http://www.babylonjs-playground.com/#1ND6TH This playground seems to not work, I get an error of n is not a function. I would really like to see a working example of this so I can do a fully deployed vehicle demo, which I will include comments on for others to be able to do the same. Quote Link to comment Share on other sites More sharing options...
RaananW Posted March 10, 2016 Author Share Posted March 10, 2016 @Pryme8 this is still the getDescendants bug, I will make sure the playground is updated as soon as possible. Pryme8 1 Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted March 10, 2016 Share Posted March 10, 2016 should be good Quote Link to comment Share on other sites More sharing options...
Pryme8 Posted March 10, 2016 Share Posted March 10, 2016 Am I mistaken but can I dig through the methods available in my physics plugin by console.log(new BABYLON.CannonJSPlugin()) or Oimo depending on which I wanna dig through and checking what that objects prototypes are and locating what ever methods I need for rigging a vehicle? Ive never done this before but I was just thinking that this might work, then I could stop bugging you guys for methods. Quote Link to comment Share on other sites More sharing options...
RaananW Posted March 11, 2016 Author Share Posted March 11, 2016 I think it would be better to simply look at the code https://github.com/BabylonJS/Babylon.js/blob/master/src/Physics/babylon.physicsEngine.ts But it is a bit more complex than this - you will have to understand the PhysicsImpostor class and the PhysicsJoint class. I take the blame, but I am working on it Quote Link to comment Share on other sites More sharing options...
Pryme8 Posted March 11, 2016 Share Posted March 11, 2016 Wow I'm a dummy... Yea this is the stuff I needed to look at the whole time. I will be able to make it happen now thank you. **EDIT**http://www.babylonjs-playground.com/#TX01V#0 Im about to add controls and joints but I think I am going in the right direction? *** ANOTHER EDIT *** So I am trying to connect one tire at this point could someone help me figure out whats going on here? Im not dropping any errors, but adding the joint effectively does nothing?http://www.babylonjs-playground.com/#TX01V#4 Wingnut 1 Quote Link to comment Share on other sites More sharing options...
Dad72 Posted March 22, 2016 Share Posted March 22, 2016 Is the documentation of the new architecture of the phisics available? I saw that on the mesh class had access to getPhysicMass() but no setPhysicsMass() function. But observing the new architecture, I saw that there was a setter getPhysicsImpostor().setParam("mass", 0) for changing the mass for example. I almost add the missing functions in the class AbstracMesh but this is not helpful with the new architecture. But the documentation would be cool and seParam is cool too. RaananW 1 Quote Link to comment Share on other sites More sharing options...
RaananW Posted March 22, 2016 Author Share Posted March 22, 2016 so! Basic usage (without getting too much into more advanced features) is documented here - http://doc.babylonjs.com/overviews/Using_The_Physics_Engine To your question - physics and mesh are now totally separated. The old functions are there for legacy reasons, but from now on changing the physics mass, friction, or anything else will be done in the impostor. I will document the more advanced features (like real-time mass changing and its consequences) in the next tutorial. I am planning at least two more tutorials - advanced usage and deeper understanding of joints. This might take some time, let me know if you have any questions to the basic usage. And the code is always there Wingnut, satguru, Sebavan and 5 others 8 Quote Link to comment Share on other sites More sharing options...
Dad72 Posted March 22, 2016 Share Posted March 22, 2016 Ok, thanks Raanan Quote Link to comment Share on other sites More sharing options...
Dad72 Posted March 23, 2016 Share Posted March 23, 2016 Very nice documentation on physical Raanan. is well detailed, well explained ... if documentation of advanced physics is like that, it's really great. The physics of Babylon really starts to please me. RaananW 1 Quote Link to comment Share on other sites More sharing options...
jerome Posted March 23, 2016 Share Posted March 23, 2016 huge doc ... !!! To everyone who never tried to write a full doc so far, what is a long and painful work, I can assure that this Raanan's production is really impressive webGLmmk, GameMonetize, ian and 1 other 4 Quote Link to comment Share on other sites More sharing options...
satguru Posted March 23, 2016 Share Posted March 23, 2016 Agree, a very well written document! Thanks 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.