Hi,
the code is bit a mess, but I was just learning all the stuff, putting multiple techniques together. Play around with the controls, You can create pretty cool effects. Note that small camera move speed and small next segment treshold equals thousands of objects! So keep them balanced.
Hit + to log the actual controls state as JSON to the console and creating a keyframe. Add multiple keyframes. Copy and paste the last logged JSON and replace the pathData variable found at the top of the source. Change animationLength to how much seconds should the tunnel stay in the current state and skip to the next frame.
You can keep the controls open by pressing Space when in play mode to see how the controls are lerping from the current to the requested state. Keep in mind, this is code is far from production ready, I just put all together in a quickly manner, so there is a lot bullsh*t, I am aware of it ![]()
I started to add explosion of the enemy blocks, the big block is killed, a 3x3x3 is cube from smaller cubes is spawned but got lazy. Actually 95% of the code is ready, there is just an issue placing the explosion obect into world space. Afterwards correctly apply an applyRadialExplosionImpulse to the center of the big cube. Next step, using thin instances instead of regular one (some code already present).
Let me know whether you like it:
UPDATE New version with GPU instancing https://playground.babylonjs.com/#YSKAH2#4 - SWITCH PG TO BABYLON.JS 4.2.1!


