taadaaa
Cool. Is it achieved by using a bunch of MeshParts with precise angles or by another method?
Nope. Take the original mesh part, split all faces, slightly downscale all of those faces, and layer on top of the original mesh (with the original mesh having CanCollide
off).
For games with big maps using this method, wouldn’t it be quite performance intensive?
I like this, maybe you could do a version where each mesh part is one chunk! Roblox’s StreamingEnabled is specifically 64x64 chunks, it should help make things performant!
Nope. In a tweet I made, I gave a walkthrough of this method and gave a brief explanation of how it improves performance. I made the whole terrain chunk about 4k triangles, less than most weapon models in first-person shooter games.
But weapon models in first-person shooter games don’t have 4k triangle precise convex decomposition hitboxes…
Though I guess this is the only way to have accurate hitboxes in Roblox.
Here is a wireframe of a single terrain voxel.
If you have a 4k triangle map and 4k triangle hitbox, you will have far greater performance compared to Roblox-built terrain.
Your terrain hitbox has each triangle split, that combined with precise convex decomposition collision creates a 4k triangle hitbox.
Here are the hitboxes for some terrain without split triangles
Default | PreciseConvexDecomposition
Box | Hull
(mesh)
As you can see these are optimized at the cost of less accurate collisions.
Roblox-built terrain (hopefully) has a special version optimized for terrain. But even if it doesn’t it’s still much faster, though not as ‘extremely precise’, as your hitbox.
So I wouldn’t use it too much…
I wonder how PreciseConvexDecomposition would ‘decompose’ your special split hitbox. Could you post a picture of it like above? I used the Mesh Optimization Tools plugin, but you can enable it manually by going to File > Studio Settings… > Studio > Visualization > Show Decomposition Geometry
So you’re pretty much meshing out every triangle individually, and then giving each one precise convex decomposition collision, is that right? That’s pretty cool because you basically have perfect collision for every single voxel!!?
Not quite, but almost! Instead of each triangle being calculated, it’s every face. The face averages out the triangle data!
Ohhhhhh dang so you’re removing the jagged qualities of the triangles!