Page 1 of 1

ConvexHull size discrepancy

Posted: Thu Dec 15, 2016 11:20 pm
by Brendon
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:
Image

Here's the display mesh, and its simplified collision mesh:
Image Image

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:
Image

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:
Image

For pipeline reasons, I'd prefer to use ConvexHulls rather than the Box prefabs. Any tips on what could be causing this ConvexHull discrepancy?

Re: ConvexHull size discrepancy

Posted: Thu Dec 15, 2016 11:41 pm
by Norbo
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.