Object's relative positions

With two moving objects is there a way to tell if object B is to the right or the left of object A? I mean locally, not globally.

I think this should do it (C# code):

Vector3 dist = objectB.transform.position - objectA.transform.position;
float d = Vector3.Dot(objectA.transform.right, dist);
if (d > 0)
{
    // right
}
else
{
    // left
}