Пример #1
0
    void DrawCapsuleColliderBounds()
    {
        Vector3 aToB;
        Vector3 middle;

        if (capsulePointType == CapsulePointType.Transform && transformA && transformB)
        {
            aToB   = transformA.position - transformB.position;
            middle = transformB.position + aToB / 2;
        }
        else
        {
            aToB   = pointA - pointB;
            middle = pointB + aToB / 2;
        }

        Primitives.CreateCapsuleMesh(radius, otherRadius, aToB.magnitude + (radius * 2), mesh);
        mesh.RecalculateBounds();

        bounds.transform.up       = aToB;
        bounds.transform.position = middle;
    }