Runtime Mesh Component

Glad to here you got it working at least! I was going to say that enabling physics is probably what you missed.

Now, for a quickie overview on how that works… The convex mesh support there is going to take whatever you feed it in each batch and make a convex hull out of it. This means that any concavity would be filled in, but it will technically accept almost anything you feed it. The problem there is obviously by filling in concave areas you get some weird physics behaviors. What’s really needed is something like convex decomposition which will turn a big complex body into multiple smaller convex shapes. Unfortunately this is usually a very slow process unless you know enough about your input information to generate it directly. See below for the difference between convex hull and convex decomposition.

Now, the problem with what you’re doing is the sheer volume of convex objects. While I’m not entirely sure on how PhysX handles compound shapes (single actor with multiple independent shapes), My assumption is that they’re just not checked against eachother but still checked in turn against all the shapes in another actor. This leads to an exponential growth problem. If both actors have 10 shapes, you have 100 possible combinations, but if both actors have 20 shapes, then you have 400 possible combinations. With your example of 30-200 triangles independently that means upper end of 40,000 possible combinations in collision detecting 2 of those actors together. This gets even worse when colliding against a mesh. PhysX, to my knowledge, uses a BVH tree for static meshes which is why they’re incredibly fast. The problem is moving/rotating a BVH can get costly to update so PhysX doesn’t support moving triangle meshes. UE4 handles this for normal objects by either importing custom collision shapes for it or using V-HACD ( GitHub - kmammou/v-hacd: Automatically exported from code.google.com/p/v-hacd ) to decompose the triangle mesh into a small number of convex objects to approximate it. The problem is this is EXTREMELY slow in some cases (Like hours slow for complex meshes).

Now, not knowing what you’re actually working with I can’t say if there’s a way to easily figure out a roughly minimal set of convex shapes to approximate it fast enough to be usable at run-time.

Thanks! It should actually get faster here soon with the new version! Also it will use substantially lower memory in cases where you don’t need to update something after the first time (loading a static model like you are, or just generate once and use type things) and supporting multiple instances without full memory duplication.