I have a feeling I'm just missing something very basic, but after a few days I haven't been able to figure this out.
I have a little spaceship:
Here's the display mesh, and its simplified collision mesh:
I am using a ConvexHull for the ship's collision, and loading in the collision data as an .OBJ file. The problem is, the collision ends up being larger than the display mesh. Here's a debug test where I shoot a bunch of raycasts toward the ship:
The raycasts are hitting the collision, but for some reason the collision doesn't match up with the display model. I'm unclear why the ship's collision is "inflated" compared to its display model.
As a comparison point, when I replace the ConvexHull with a Box prefab, the raycast test looks correct:
For pipeline reasons, I'd prefer to use ConvexHulls rather than the Box prefabs. Any tips on what could be causing this ConvexHull discrepancy?
ConvexHull size discrepancy
Re: ConvexHull size discrepancy
It's hard to say for sure. The ConvexHullShape just takes whatever vertices are given to it without applying any scaling, so it is likely that somewhere along the content processing pipeline some scaling factors are introduced (or perhaps, accidentally excluded).
I'd recommend examining the points being passed into the convex hull, seeing if they match what you expect, and working back along the content pipeline from there.
I'd recommend examining the points being passed into the convex hull, seeing if they match what you expect, and working back along the content pipeline from there.