So I recently went through an ordeal trying to get an extremely dense collision mesh onto as perfect a sphere as possible. Here are some of my thoughts and questions from that process.
tl;dr - The in editor collision creation needs to be beefed up(literally 10 times more hulls/verts in auto-convex). The number of allowed triangles on imported collision meshes also needs to be increased(seems to have a 500 triangle limit… 20000 could be a good start, but 50-100,000 to be sure).
First, I should outline the problem I needed a complex collision mesh for. I am projecting a flat hex map into a sphere. This only projects the render and not the collision, so I need a way to interact with the map while it is projected. This is where the sphere comes in. So you have a map that could be thousands of UU wide, with individual hexes ~100 UU wide and requiring an accuracy of at least 1-10UU from the point of click. So if a player clicks the edge of the hex, I need to get that exact position(as rendered/viewed) so I can get the correct hex that the player clicked on. If it is more than a few UU off, then it unexpectedly gets a neighbor hex and bad things happen.
So, the best collision sphere that the editor can produce gives me an accuracy that is pretty bad. Up to several hundred UU off when clicking around on a sphere that is 5,000 UU across. This is because the mesh isn’t a true sphere and has a bumpy polyhedron shape. The more triangles in the collision mesh, the less bumpy and more sphere-like. The bumps are key, because anything that raises off the curved projection is going to produce a hit result that is different from what the player is seeing when they click a hex.
This pic shows you the projected sphere overlaid with the collision sphere. What you see is the rendered collision mesh and not the collision verts, but the collision has a similar problem with the “troughs” between the sphere and the polyhedra. Notice the red trace response on a hex at the end of the mountain chain is not producing a mountain on the hex that is clicked. That is because it actually collided with the hex in front of it due to the bumpy collision mesh. Almost like trying to do a line of sight trace over a small mountain, I need to smooth the bumps out.
So autoconvex collision is not good enough. With hulls and verts maxed out in the editor(24 hulls and 32 verts), it produces something like this:
Simplified sphereical collision produces a sphere that is still a polyhedra and a pretty bad one at that. Complex as simple and simple as complex both have inaccurate collision results compared to the sphere, though selecting them doesn’t show any collision verts in the editor so I really have now idea what they are actually doing.
So, this is about the point where I gave up on in-editor collision and was trying to import a collision mesh to do the job. Long story short, I hate Blender, and I couldn’t get anything to work. Luckily, I had outside help(J. J. Franzen) and was able to create a working collision mesh with 100 divisions and is maybe ~98-99% accurate on a 5000UU wide sphere. This basically means that I can click about 15-20 hexes away from the player camera and get a response that is ~20-40UU off the actual click point. Still needs a lot of work(especially for maps that are 4-8 times as big), but it is good enough to assure me that I am on the right track trying to get a smoother collision sphere.
So the problem we have now is that it seems the editor does not want to import any collision mesh with more than ~500 triangles. Has anyone seen this or have any idea of a workaround?
I understand that there are very few circumstances that need a collision mesh this accurate, but I have found one and there are bound to be more cases that need highly accurate collision response. If anyone knows of alternative methods to achieve the desired result I am all ears. In general though, the editor needs it’s collision vert limits raised. Thanks.