GameMonetize Posted January 6, 2017 Share Posted January 6, 2017 BUT...BUT... Where is my PR??? Quote Link to comment Share on other sites More sharing options...
jerome Posted January 6, 2017 Author Share Posted January 6, 2017 You'll have to pay much for this one. Very much. Not even sure you can afford it Quote Link to comment Share on other sites More sharing options...
jerome Posted January 6, 2017 Author Share Posted January 6, 2017 Hi guys, I just updated a little the physics so that the particles colliding the skull are given the skull rotation speed also : http://www.babylonjs-playground.com/#EIXPN Quote Link to comment Share on other sites More sharing options...
jerome Posted January 6, 2017 Author Share Posted January 6, 2017 can't stop playing : http://www.babylonjs-playground.com/#EIXPN#1 In this one, the particles are dynamically morphed according to their own velocity (stretched). This is CPU intensive, but it still runs at 60 fps in Chrome here. The magic is at the line 168. Have fun. Quote Link to comment Share on other sites More sharing options...
jerome Posted January 9, 2017 Author Share Posted January 9, 2017 under the hood optimization of some computations and better mesh partitioning ... the physics keeps un-modified, this one runs at 60 fps in Chrome here with 2000 balls : http://www.babylonjs-playground.com/#PLPPV adam 1 Quote Link to comment Share on other sites More sharing options...
jerome Posted January 9, 2017 Author Share Posted January 9, 2017 The bug about the translation seems finally fixed : http://www.babylonjs-playground.com/#PLPPV#2 http://www.babylonjs-playground.com/#PLPPV#3 http://www.babylonjs-playground.com/#PLPPV#4 and it works with the scaling too : http://www.babylonjs-playground.com/#PLPPV#6 Quote Link to comment Share on other sites More sharing options...
adam Posted January 9, 2017 Share Posted January 9, 2017 http://www.babylonjs-playground.com/#PLPPV#7 Quote Link to comment Share on other sites More sharing options...
jerome Posted January 9, 2017 Author Share Posted January 9, 2017 Quote Link to comment Share on other sites More sharing options...
jerome Posted January 10, 2017 Author Share Posted January 10, 2017 I've just updated the code to make it cleaner and I've commented it so the custom simple physics is understandable : http://www.babylonjs-playground.com/#PLPPV#9 from the line 128, to see how the collision is handled NasimiAsl 1 Quote Link to comment Share on other sites More sharing options...
jerome Posted January 10, 2017 Author Share Posted January 10, 2017 PR coming tomorrow (I hope) as it was tested for 5 days now Quote Link to comment Share on other sites More sharing options...
jerome Posted January 11, 2017 Author Share Posted January 11, 2017 ok, ok, I read back the former post about the physics commented code and I found out that all the stuff about switching between the world space and the local space (then switching back) was quite complex for many users...well, far from the BJS motto : simple & powerful. That's why I changed the final facetData API and added some methods to hide all this stuff, so now the users can do everything directly in the world space. Thus the physics code on collision is now really simple (from the line 131) : http://www.babylonjs-playground.com/#PLPPV#10 [EDIT] scaling adaptation still respected : http://www.babylonjs-playground.com/#PLPPV#11 I guess it's ok for a PR now ... let's go to translate all this to TS. [EDIT 2] Little (documented) physics refinement about the computation of previous position : http://www.babylonjs-playground.com/#PLPPV#12 Quote Link to comment Share on other sites More sharing options...
jerome Posted January 11, 2017 Author Share Posted January 11, 2017 PR just submitted in short : Brand new feature : Mesh Facet Data Examples : mesh.updateFacetData(); // enables and computes the facet data for this mesh // this can be called on demand, if the mesh is // morphed for instance, even in the render loop // get the index of the closest facet to (x, y, z) in the world var i = mesh.getClosestFacetAtCoordinates(x, y, z); var position = mesh.getFacetPosition(i); // returns the i-th facet world position var normal = mesh.getFacetNormal(i); // returns the i-th facet world normal // then do stuff with these values, i.e your own physics... // you can even get the closest point to (x, y,z) ! var proj = BABYLON.Vector3.Zero(); i = mesh.getClosestFacetAtCoordinates(x, y, z, proj); // proj is (x, y, z) projected on the closest facet Note : all the facet data computation are done by ComputeNormals() in the same loop, so it's really fast and doesn't impact the usual normal computation. JohnK, Nockawa, Wingnut and 1 other 4 Quote Link to comment Share on other sites More sharing options...
jerome Posted January 13, 2017 Author Share Posted January 13, 2017 Well, some test demos with always the same simple physics (on my site, waiting for the merge) Now the updatable parametric shapes (ribbon, tube, extrusion,etc) automatically update the internal mesh partitioning when the update by the call to "CreateXXX()" with the parameter "instance". So nothing to do for the user more than to call as usual "CreateXXX()" and the facetData are updated in the same time http://jerome.bousquie.fr/BJS/test/facetdata3.html Moreover, you remember that the SPS is mesh, don't you ? so, as a mesh can have its facetData, a SPS can also. Like for the dynamically morphable parametric shapes, the internal facetData are automatically updated by the call to "setParticles()" if they are enabled for the SPS. example : facetData sps (boxes and torus) vs falling ball sps : http://jerome.bousquie.fr/BJS/test/facetdata4.html Quote Link to comment Share on other sites More sharing options...
jerome Posted January 13, 2017 Author Share Posted January 13, 2017 @Deltakosh please let me know when the PR of this feature is pushed to the PG so I can make some demos, thanks Quote Link to comment Share on other sites More sharing options...
Wingnut Posted January 13, 2017 Share Posted January 13, 2017 I smell Tonka. How 'bout you guys? Hey Jerome... how about we fill-up a "sandbox" with sps, and see if they play nice with EACH OTHER... when contained in that topless box. Then I'll jump in there with my Tonka MotorGrader and plow some roads... like when I was age 4. FUN! Then... Snowblower Simulator 1.0 So much fun ahead! Could make pretty good bullets, too... for the carnival shooting games. Basic collision, nothing fancy... but a FAST machine gun is possible. (not sure if facet data is needed for that, though). Nice work, J-Man! Quote Link to comment Share on other sites More sharing options...
jerome Posted January 13, 2017 Author Share Posted January 13, 2017 Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted January 13, 2017 Share Posted January 13, 2017 PG updated! Quote Link to comment Share on other sites More sharing options...
satguru Posted January 13, 2017 Share Posted January 13, 2017 @jerome dumb question , what is facet? same as face? Quote Link to comment Share on other sites More sharing options...
JohnK Posted January 13, 2017 Share Posted January 13, 2017 Had a discussion with Jerome way back and adopted the term facets for the triangles that form a mesh in BJS. A face is an adjacent group of facets with the same normals. The reason being for example - a box has six faces whereas in BJS it made up of twelve facets since each face is constructed from two facets. The circular caps of cylinders are faces made from many facets. Quote Link to comment Share on other sites More sharing options...
satguru Posted January 14, 2017 Share Posted January 14, 2017 @JohnK ahh,, understand now Quote Link to comment Share on other sites More sharing options...
BangTao Posted January 14, 2017 Share Posted January 14, 2017 On 2016/12/17 at 0:02 AM, jerome said: How can i use 100*100*100 octree at http://www.babylonjs-playground.com/#2KXNQ6#2 Quote Link to comment Share on other sites More sharing options...
jerome Posted January 14, 2017 Author Share Posted January 14, 2017 @JohnK perfectly answered @satguru 's question (better that I would have done with my own word in english). So a facet is a basic triangle built with 3 vertices. @BangTao : the PG you're using is one of the first of the prototype. Just wait for the feature to be pushed in the PG (and for the upcoming documentation) and then use only mesh.partitioning Subdivisions = someInteger instead. Btw, I have an idea to improve the internal partitioning (what is not a real octree, that's why the has changed since the first prototype) to auto-adjust according the axis if, say, the mesh has a big size along X and is really small along Y : a plane for instance has almost only 2 dimensions x and z, for instance, so it's not pertinent to partition its y dimensions in, say, 10 subdivisions Quote Link to comment Share on other sites More sharing options...
BangTao Posted January 14, 2017 Share Posted January 14, 2017 that's greet .i can't wait it well ,would you please simplyly tell me how to run in loophttp://www.babylonjs-playground.com/#SRA5B#0 the little red ball is from (0,0,0 ) to (10,10,10),i need quickly get the closest facet to the red ball.i wanna use "for loop" ,but it did'nt check the facet every time i modified the (x,y,z) Quote Link to comment Share on other sites More sharing options...
jerome Posted January 14, 2017 Author Share Posted January 14, 2017 Please wait We are still in alpha and the API is not definitive for now. To answer your question, the method getClosestFacetAtCoordinates(x, y, z) will return the closest facet at (x, y,, z) expressed in the world and this method is also designed to be called as many times as needed, so each frame if you want or even many times per frame. Under the hood it's just a quick computation of an index, and access to an array and another light comparison between a distance fast computation. In my example of falling balls, it's called once per particle, so 2000 times per frame for 2000 particles ! Quote Link to comment Share on other sites More sharing options...
jerome Posted January 16, 2017 Author Share Posted January 16, 2017 at last, in the PG : http://www.babylonjs-playground.com/#XVGK0#0 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.