jerome Posted January 22, 2016 Share Posted January 22, 2016 Little fun for the week-end : http://www.babylonjs-playground.com/#1MURF7 A dynamic texture applied on a SPS composed with many little planes stuck together. Press "SPACE" then ... BOOM The same with an opaque texture to better understand : http://www.babylonjs-playground.com/#1MURF7#1 From the line 32, you can change some parameters. example : http://www.babylonjs-playground.com/#1MURF7#2 or something more dynamic : http://www.babylonjs-playground.com/#1MURF7#4 much more : http://www.babylonjs-playground.com/#1MURF7#5 Just make sure that your mouse pointer is NOT in the editor part, but in the scene part, else you can have some funny effect by pressing SPACE (or keeping it pressed) Dad72, Dal, JohnK and 4 others 7 Quote Link to comment Share on other sites More sharing options...
Dal Posted January 22, 2016 Share Posted January 22, 2016 Could be really cool to make a wall that can be knocked down in-game... a cheap way of making destructible meshes Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted January 22, 2016 Share Posted January 22, 2016 Wooot! this is excellent Quote Link to comment Share on other sites More sharing options...
gryff Posted January 22, 2016 Share Posted January 22, 2016 As always jerome your stuff fascinates me - it is almost hypnotic The position of the mouse pointer does have an impact - I went to the demo and watched the particles explode and collect at the edges of the floor. I wanted to watch it again (I said it was hypnotic ), so I clicked the RUN button again and hit the spacebar and I got one of those "funny effect" - the explosion reverses itself as soon as I let go of the spacebar which is also a nice effect. cheers, gryff Quote Link to comment Share on other sites More sharing options...
jerome Posted January 22, 2016 Author Share Posted January 22, 2016 Gryff, you just found the mysterious treasure ... PG side effect Thanks for the gentle words gryff 1 Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted January 22, 2016 Share Posted January 22, 2016 This has to be a feature demo! Quote Link to comment Share on other sites More sharing options...
jerome Posted January 22, 2016 Author Share Posted January 22, 2016 why not ? but there's nothing new here : the SPS and a DynamicTexture only Quote Link to comment Share on other sites More sharing options...
jerome Posted January 22, 2016 Author Share Posted January 22, 2016 (edited) @Dal : yep, for destroyable walls... I just change here the model CreateBox instead of CreatePlane : http://www.babylonjs-playground.com/#1MURF7#6 same opaque : http://www.babylonjs-playground.com/#1MURF7#7 well... "Box" instead of "Plane", changing only 4 letters and this works ... [EDIT] can't stop playing ... discs : http://www.babylonjs-playground.com/#1MURF7#8 (triangles... discs with 3 sides : http://www.babylonjs-playground.com/#1MURF7#13 ) torus : http://www.babylonjs-playground.com/#1MURF7#9 torus knots : http://www.babylonjs-playground.com/#1MURF7#10 tetrahedrons : http://www.babylonjs-playground.com/#1MURF7#11 spheres : http://www.babylonjs-playground.com/#1MURF7#12 Edited January 22, 2016 by jerome Quote Link to comment Share on other sites More sharing options...
gryff Posted January 22, 2016 Share Posted January 22, 2016 Quote but there's nothing new here Well jerome, I think it has to do with demos being a dramatic visualization of the features of BJS. You can read the docs and never think of what combining two features might produce - to paraphrase the old saying "a demo is worth a thousand words". And as for the "gentle words" - your coding does fascinate me. I thought about using your spiral mesh creation (I had seen it in a demo) for decorations in my last xmas card piece. (Just could not figure out how to have the spiral run horizontally and bend in the middle from gravity. ) As for your SPS particle system - I keep thinking "leaves on trees", though I don't know what performance issues might be created. cheers, gryff EDIT: And as a more general comment - this Demos & Projects subforum is a great addition because it does give people the opportunity to illustrate what can be done with BJS. jerome 1 Quote Link to comment Share on other sites More sharing options...
jerome Posted January 22, 2016 Author Share Posted January 22, 2016 aahhh... ok for the "dramatic visualizations" maybe, I need to add some shadows also, or some post-process, maybe an explosion sound one more for tonight with transparent tetrahedrons : http://www.babylonjs-playground.com/#1MURF7#14 About "leaves on trees", it would interesting to test this... My old laptop computer can handle thousands of triangular or quad particles in the space (rotated, positionned, etc)... maybe it might work Quote Link to comment Share on other sites More sharing options...
jerome Posted January 22, 2016 Author Share Posted January 22, 2016 funny ... internal pseudo physics don't take in account off limit cases : http://www.babylonjs-playground.com/#1MURF7#15 wait and see, everything ends to fall strangely Quote Link to comment Share on other sites More sharing options...
Dal Posted January 22, 2016 Share Posted January 22, 2016 @jerome Next challenge: put all the pieces back together in the correct order Quote Link to comment Share on other sites More sharing options...
jerome Posted January 22, 2016 Author Share Posted January 22, 2016 Quote Link to comment Share on other sites More sharing options...
Temechon Posted January 22, 2016 Share Posted January 22, 2016 Don't challenge him like this, he could succeed Very nice demo Jerome ! Quote Link to comment Share on other sites More sharing options...
jerome Posted January 22, 2016 Author Share Posted January 22, 2016 why did you talk about this ...? Now the idea is in my mind, tssssss Quote Link to comment Share on other sites More sharing options...
jerome Posted January 22, 2016 Author Share Posted January 22, 2016 Rock'n'roll : http://www.babylonjs-playground.com/#1MURF7#16 1/3 tetrahedrons, 1/3 boxes, 1/3 quads... what a cocktail ! Quote Link to comment Share on other sites More sharing options...
jerome Posted January 22, 2016 Author Share Posted January 22, 2016 BTW, I forgot to tell that you can also set the explosion radius at the line 67 : http://www.babylonjs-playground.com/#1MURF7#18 Quote Link to comment Share on other sites More sharing options...
jerome Posted January 23, 2016 Author Share Posted January 23, 2016 Little improvement : the energy restitution is now per box http://www.babylonjs-playground.com/#1MURF7#19 this means that each box bounces differently [EDIT] just added a ground friction so the bricks don't roll forever on the ground : http://www.babylonjs-playground.com/#1MURF7#20 Quote Link to comment Share on other sites More sharing options...
Wingnut Posted January 23, 2016 Share Posted January 23, 2016 Just amazing! I love it! "let's set the texture per quad", he says. YES! Good good good! I might have another use for that... over in the applyDisplacementMap to tiled ground thread. Quote Link to comment Share on other sites More sharing options...
NasimiAsl Posted January 25, 2016 Share Posted January 25, 2016 just Wow ! i think BJS need Build a space in Babylonjs.com for samples like this and developers Build that step by Step in here and share it we have very wonderfull sample in PG but Just a little people know about . Quote Link to comment Share on other sites More sharing options...
jerome Posted January 25, 2016 Author Share Posted January 25, 2016 Ok I'll do a feature demo soon, more beautiful than this one. This gave me an idea to extend the SPS and make any mesh decomposable into particles (so blowable ) GameMonetize 1 Quote Link to comment Share on other sites More sharing options...
jerome Posted January 27, 2016 Author Share Posted January 27, 2016 http://www.babylonjs-playground.com/#2AF3KM News : - better pseudo-physics : the particles don't fall or roll forever and keep really in the big box - added some shadows from a fixed directional light. As I don't know how to set forever a constant bounding box to the SPS mesh, its bounding box is recomputed each frame with sps.afterUpdateParticles() in order to compute the right shadows. This works still at 60 fps in Chrome here. I just couldn't have the shadows work from a moving point light, I'm waiting for an answer about this in another topic.(see EDIT 2) - the explosion impact is now computed straight from the mouse pointer position when you click (no more velocities pre-computation) - better code comments for interested people For people just wanting to have fun at blowing things, the parameters are from the line 41 [EDIT] something funny : you can ever blow the particles when they are flying, falling or even rolling on the ground. Just pick & click [EDIT 2] http://www.babylonjs-playground.com/#2AF3KM#1 The same with the point light shadows fixed as explained here : Boz 1 Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted January 27, 2016 Share Posted January 27, 2016 This is awesome!! Quote Link to comment Share on other sites More sharing options...
jerome Posted January 27, 2016 Author Share Posted January 27, 2016 something even better soon ! Quote Link to comment Share on other sites More sharing options...
jerome Posted January 28, 2016 Author Share Posted January 28, 2016 Here is it : http://www.babylonjs-playground.com/#1JFDFW#9 News : - the particles bounce on a height map : the bounce angle is computed from the velocity angle when hitting the ground. Actually, the symetric vector of the velocity vector by the ground normal vector is computed and is applied an attenuation (energy loss). This illustrates the usage (and the speed) of the new getHeightAtCoordinates() and getNormalAtCoordinates() Ground methods. - the wall still explose where you pick it, but now the explosion direction is set according to the camera-picked point axis, like you were shooting the wall from your point of view. Finally, I've got my light pseudo physics for explosions upon a relief to start an artillery game [EDIT] for easier access to the parameters, I set them at the start of the code from the line 3. And you can still blow flying or rolling particles then ... [EDIT] just removed the shadows (and the per frame bounding box recomputation) and increased to 6300 cubeshttp://www.babylonjs-playground.com/#1JFDFW#4 still 60 fps in my Chrome here [EDIT] fixed the velocities when you re-click on moving particles and updated the PG links in this post GameMonetize, Boz and satguru 3 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.