Esempio n. 1
0
    private void CollisionCapsule()
    {
        float3 pa      = posA;
        float3 pb      = posB;
        float  lengthA = extentsA.y * 2;
        float  lengthB = extentsB.y * 2;
        float  radiusA = extentsA.x;
        float  radiusB = extentsB.x;

        if (ColPhysics.CapsuleIntersectsCapsule(pa, pb, rotA, rotB, lengthA, lengthB, radiusA, radiusB, out float distance))
        {
            isColliding = true;

            if (resolveCollisions)
            {
                ColPhysics.ResolveSphereCollision(ref pa, ref pb, radiusA, radiusB, distance);

                posA = pa;
                posB = pb;
            }
        }
    }