Ok, I have a very simple goal here. Make a modular vehicle with an interior. Sounds easy right? Tons of games have customizable cars that a player can sit in, right?
So, let’s talk about the physics of this car. My understanding is that there are two types of collisions in the engine, primitives (shapes) and tri-mesh. Primitives are convex water-tight meshes, and tri-meshes are pretty much anything shape of geo you want. This difference in the engine is usually known as Simple Collision vs Complex Collision.
So let’s go back to our example, a car. Per the Unreal documentation, you should use a Skeletal Mesh to setup the body and the wheels. Ok, that’s fine. Let’s pull one into the editor and open up the Physics Asset.
Using one big collision primitive/shape could be useful for a car where nothing is going on inside of it. But we want a car with an interior (again, not a crazy request). So we do away with the one collision shape for the car. We can start setting up multiple collision shapes to kind of “carve out” the interior of the car. This becomes problematic for a few reasons though. First of all, it’s not really precise or easy to setup. Secondly, the more collision shapes you have, the more expensive they are (especially if they are moving). And a car, um, you know, needs to move to be useful. Hmm, ok, what about the tri-mesh option? If I wanted a “hole” in the collision where my modular door should be, tri-mesh should be able to do it without using multiple collision volumes. So tri-mesh to the rescue, right…?
Wrong! Custom tri-meshes (and you want a custom one, you don’t want a 20K vert collision tri-mesh coming from your final art) are only available on static meshes. Ok, so what now…?
Ok, crazy idea here: since a car is (for our purposes) a hard surface, why not use the car skeleton without the geo, then add a Static Mesh component to the Root bone and have a custom tri-mesh on that? We don’t need any weighted verts. Crazy thing is, this actually works. With one slight problem…
When you use a tri-mesh you can no longer simulate physics… so um, our car becomes useless again because it can’t move.
So a few things, no I can’t leave the car as one big primitive and disable collisions on the player when he enters the car. I need collisions in the interior of the car. And using a ton of different collision channels and swapping components to use the right one is a sound idea in theory but not really scalable and a nightmare in practice. And yes you could also have a custom movement component but then aren’t you reinventing the wheel (pun intended) here? All of these potential solutions sound hack-ish at best and flat out wrong at worst.
So, am I crazy (full disclosure: I probably am), or should there be a much simpler and straightforward way to do this…?