Hello!
Is it possible to correctly shift planes?
If so - how to do this?
I need to shift the clip-planes so that their distances was the same distances of the point-hull planes.
I do so:
Code:
const Math::Vector3D hullSizes[Hull_Total][2u] =
{
/* Mins */ /* Maxs */
{Math::Vector3D ( 0.0f, 0.0f, 0.0f), Math::Vector3D ( 0.0f, 0.0f, 0.0f)}, // Hull_Point (0x0x0)
{Math::Vector3D (-16.0f, -16.0f, -36.0f), Math::Vector3D (16.0f, 16.0f, 36.0f)}, // Hull_Human (32x32x72)
{Math::Vector3D (-32.0f, -32.0f, -32.0f), Math::Vector3D (32.0f, 32.0f, 32.0f)}, // Hull_Large (64x64x64)
{Math::Vector3D (-16.0f, -16.0f, -18.0f), Math::Vector3D (16.0f, 16.0f, 18.0f)} // Hull_Head (32x32x36)
};
const Math::Vector3D offset
(
plane.normal.x >= 0.0f ? hullSizes[hullIndex][0u].x : hullSizes[hullIndex][1u].x,
plane.normal.y >= 0.0f ? hullSizes[hullIndex][0u].y : hullSizes[hullIndex][1u].y,
plane.normal.z >= 0.0f ? hullSizes[hullIndex][0u].z : hullSizes[hullIndex][1u].z
);
plane.distance -= Dot (offset, plane.normal);
but this won't work for some planes (for example floor) - this conversely shifts plane to opposite side.
Please help.