I’m trying to import a mesh from a GLTF file and turn it into a rigid body - physics object.
I have the ConvexHull collision meshes modeled and ready, but the docs example playground (Babylon.js Playground) is pretty convoluted and weirdly organized and I’m not understanding what’s the correct way to do this.
Can anyone suggest how to properly set this up from scratch? What’s your setup when using imported meshes to be used as physics objects (specifically from GLTF files)? How do you set it up with the imported collision meshes - ‘physicsImpostor’ (not created within babylon)?
AFAIK, there is no way to automaticaly create impostor when loading a scene (.gltf/.babylon/…).
I’ve found a thread and a playground that illustrate creating impostor for a scene.
Basically, impostor type is created based on mesh name. ( check lines 226 to 232)
Thank you for sharing that playground! It’s nice to have an example that’s not written as weirdly as the one in the docs.
However it seems that it just doesn’t import any of the collision meshes. It’s just using primitives generated by BabylonJS, not the imported ConvexHull collision meshes - which is usually the standard way of doing collisions in games.
I’m really enjoying BabylonJS overall so far…but damn is it confusing and weirdly organized sometimes, especially with everything that’s related to GLTF - a Browser based game engine that has it’s weirdest quirks when importing models with the format created for 3d on the web is quite frustrating to be honest.
A few gripes I have with all this setup/process so far:
Why do we need to make an ‘empty’ mesh object and place it arbitrarily in the scene, then have to parent all the imported meshes including collisions to it? ‘Center of Mass’? Why isn’t it just the origin of the mesh by default and one could use that weird trick to customize if needed? In UE4 that’s how it’s done - it’s easier to understand (I mean it’s the origin of the mesh, makes more sense), easier to author content - every game asset is ALWAYS exported with the mesh origin at a specific place according to the needs.
By the way: scaling the ‘physics root’ ?? What? Why? Can’t even conceive the imagination for why that would even be possible…
Why is it that the collision proxies have to be instantiated inside a property of mesh that’s authored specifically to act as a collision mesh - you have to create a ‘collision impostor’ and set it to the collision mesh? That doesn’t make much sense to me. Couldn’t it just be a flag you activate on that mesh and that would set it up? You would create new ones if you’d want to use Babylon’s primitive meshes for quick prototyping, but for imported Collision Meshes it’s a bit weird.
Everyone knows real-time physics need collision proxies for performance so just setting that rule could simplify the entire process. Assume the user would never try to use weird meshes for physics and have a flag that sets physics for the specified mesh?
I’m not saying it’s easy to achieve, but apparently as it is now - one has to create a collision proxy in order for the collision proxy one has authored to work as such…
And even beyond that, having to deal with all the weird stuff associated with GLTF - the ‘magical’ transformations that happen to the mesh and also the ‘root’ parent, etc…
I’m sorry if all this sounds a bit too harsh. I really think Babylon is awesome and honestly, possibly the best 3D Game engine for the browser out there. I’m just super frustrated with all this weird process and I’m not understanding the intended 3D content workflow in Babylon. I know I mainly use Unreal and that’s impossible to compare but yeah IDK, just wanted to give some feedback and try to understand how to make things work. I’m having very weird behaviors with just the basic physics setup, which could also be on my end. I’ll try to check where the issues are coming from…
Babylonjs is open source and we highly encourage community PR to improve the engine.
If you have ideas/concepts that will make the experience better, feel free to open a PR.
As long as back compat is preserved, anything can be done.
Should suggestions be placed somewhere here on the forum first to be discussed, etc? I don’t have enough programming experience to make changes myself, unfortunately.
I’m primarily a 3D game artist learning some programming/technical skills in order to make my own prototypes/demos, but I could try to write out a couple suggestions/etc if it would help improve the tools.
As I’ve written in my last reply, I’m mainly trying to understand what’s the intended workflow for content implementation, so even though we’re now talking about suggestions/helping improving the tools/etc. I just want to clarify that I’m still very much looking forward to know how people make this work for them, so I can try to first make my thing work and then to improve the workflow. I’m getting very weird behavior and I’m not entirely sure what’s going on. I’ll double check my current solution with the given resources.
The forum is perfect for discussing ideas/solution proposal. For more concrete development, Github is preferable.
Also, you can improve with smaller PR, documentation updates, example PG…anything that can help people. Even a blogpost explaining how you achieve a particular task is helpful.
Awesome! Where would one post suggestions (here in the forum - sections)?
Yes! I’ve thought about making some quick tips/tricks on youtube and maybe some blog posts somewhere or some Playground stuff. I think I need to build up some confidence first - might get into it when I get a couple demos/prototypes working!