Too long to read just go straight to the video: babylonjs arcade flight simulation - YouTube
While ago I made a HUD display with canvas2d. I thought it would be nice to attach a mesh of a plane to it. Then maybe some physics for flight, physics for suspension (raycastVehicle), skybox, clouds, terrain and I ended up with this. Initially started with threeJS but moved to babylonJs. It seemed more structured plus I would love to switch to webGPU on some stage. Also the community is great!
Anyway, its far from perfect but I am posting it to get some false sense of accomplishment I started adding dynamic terrain but I gave up for now since I need to figure out how to approach physics for the terrain. Right now its just imposter for a whole mesh. I had to learn blender to make the airplane more suitable for a game. Right now I have box and sphere imposters as invisible meshes but thinking to do it only with airplane mesh since its very low count. I am thinking to re-do it and just make wing and tail tips more dense mesh. Does this make sense? For the terrain I used one of my favorite places in Ireland from the time I lived there. I had to generate it and optimize in blender.
I hope for some constructive feedback. It would be nice to make it nicer looking without loosing performance.
Nice work! You seems to be a much better programmer than a pilot!
I’m working on custom collision stuff right now. I had to figure out, how to pick a mesh from more than 1 million instances. I’m using a sort of octree algorithm to achieve this. Your goal seems to be the same. I am open to discussion. Babylonjs is using octrees as well, but I wanted my own stuff.
I am pretty bad at both flying and programming Its a bit challenging to control yaw, pitch and roll from keys. One of the things I want to add is a IMU based controller like daydream from google. I have a similar for AR headset called miraprism and really like it. I hacked it already and wrote a lib for it with webbluetooth. I saw some libs for daydream on babylonjs so need to look into it but like the other controller better.
As for the physics I would love to test your stuff in my little project. We can set up a branch. I was thinking to drop the physics for a whole terrain. Keep it only for some landing zones. For anything else just detect my airplane crossed terrain and add crash animation while removing airplane mesh.
It’ll not work for you out of the box. It’s tightly coupled with my scene. However the idea behind it is to organize your colliders into a tree. I’m starting from a big box collider covering the whole mesh. After that I start to create smaller colliders (half the size of the previous one) and set them as children of the previous one. After I hit the last box collider I go further using raymarching (or you can use a ray) and I am trying to hit one of the meshes which belongs to the last box collider hit. Obviously you need to assign the meshes to the colliders. My colliders are just simple data: a Vector3, first corner, width, height, depth, no rotation. I think you could set box colliders for rough collision detection and you can trigger the mesh collision detection of a specific collider or colliders which belongs to the box collider used for rough detection.
Or a low poly model of your ground? There is a function in BabylonJS to degrade your mesh. If you haven’t already, search for Auto LOD or the Mesh.simplify method in the docs.
It sounds like this is related to your thinnizator work. I followed some post its pretty cool.
Yes I saw the auto LOD feature but havent tried it yet. I need to learn about the topic more how to approach the problem. For the flight phase I wanted to make the terrain mesh physics sleep but its problematic with ammojs. I suppose loosing details when I am higher would be beneficial.
I think the next thing I want to try is write shader for water. The babylonjs stuff its not exactly what I am looking for (water material doesnt support shadows). I want something super simple like moving two bump normal textures. Would be cool since I never made a shader so nice learning experience.
It’s about thin instances yes. Thanks for finding it cool! But it’s more related to the Dude Boss shooter. I am now at 600.000 shootable particles and reached the max heap limit of 2 GB for one tab. I am using the Solid Particle System. Still running at 144FPS+. I have a cubic world so it’s far more easier for me. I’m shifting towards pure thin instances to reach the goal of 1.000.000 shootable instances. The water shader is quite easy task and is a good start. I have created a couple of them as well.
This is looking nice !!!
You can erase the “false” right now, this is a TRUE ACCOMPLISHMENT! It’s not a simple task to join together all these different systems into something cohesive and that’s exactly what you did. I think the terrain looks pretty cool already, and the water on the shoreline, but the water farther in the ocean looks a bit too regular? Maybe adding some perturbations, some wave effects, would shake things up.
I’m excited to see what you add more!
Thank you for kind words I am learning about shader’s right now. I am having a lot of fun with it and excited what I can come up with. The first one will be for the water for sure.
Shaders are a real fun journey!