If the vertices and positions are used directly:
Code: Select all
Vector3 center;
ConvexHullShape convexHullShape = new ConvexHullShape(vertices, out center);
var entity = new Entity(convexHullShape);
entity.Position = new Vector3(-2.100759f, 0, 0)1;
var box = new Box(new Vector3(0.7381939f, 0, 0), 3.61321259f, 0.9600016f, 4.40804768f);

- gap.png (21.14 KiB) Viewed 8692 times
A gap! This is expected, because setting an entity's position puts the entity's center of mass right at that position. The local origin in the external program did not use the center of mass for the position, so there's an offset.
If the computed center is then added to the position of the convex hull:
Code: Select all
Vector3 center;
ConvexHullShape convexHullShape = new ConvexHullShape(vertices, out center);
var entity = new Entity(convexHullShape);
entity.Position = new Vector3(-2.100759f, 0, 0) + center;
var box = new Box(new Vector3(0.7381939f, 0, 0), 3.61321259f, 0.9600016f, 4.40804768f);

- nogap.png (20.99 KiB) Viewed 8692 times
They now touch! But it's still probably not quite what you want; I assume the wedge should be flush on top and bottom with the box.
Because the convex hull has a base y coordinate of 0, it's probably the case that the box's position is similar- that is, the origin of the box in the external program was at the bottom of the box, not at the center of mass.
If half the height of the box is added to the position of the box:
Code: Select all
Vector3 center;
ConvexHullShape convexHullShape = new ConvexHullShape(vertices, out center);
var entity = new Entity(convexHullShape);
entity.Position = new Vector3(-2.100759f, 0, 0) + center;
var box = new Box(new Vector3(0.7381939f, 0, 0), 3.61321259f, 0.9600016f, 4.40804768f);
box.Position += new Vector3(0, box.HalfHeight, 0);

- nooffseteither.png (21.4 KiB) Viewed 8692 times
No gap, no vertical offset!
While I'd like to make this stuff easier and more obvious, it's difficult to address from within the engine.
-The engine can't trust the origin supplied by the external program to be anything near the center of mass. If it did, just getting proper rotational behavior would inherit this complexity.
-Adding additional layers of helpers could help in isolated cases, but the extra layers of apparent magic would make it harder to understand exactly what was going on in the general case.
At its core, this is a content pipeline issue. The content pipeline can produce arbitrary mesh data and positions. The engine has no direct control over the pipeline; all it can do is define a standard for its input and hope the content pipeline satisfies its requirements.