Vuforia raycast - Need name of object im looking at

I can do this in a normal unity scene using the following:

RaycastHit hit;
        var cameraCenter = camera.ScreenToWorldPoint(new Vector3(Screen.width / 2f, Screen.height / 2f, camera.nearClipPlane));

        if (Physics.Raycast(cameraCenter, this.transform.forward, out hit ,1000))
        {
            print("I'm looking at " + hit.transform.name);
        }

But this is not seem to read objects in my vuforia scene. I have 2 object both with a box collider.

It like it not looking at what I think I’m looking at.

Any ideas?

I have no idea about Vuforia :frowning:

But it looks like the Ray is casted in the wrong direction.

Did you try making a reference of the Camera instead?

RaycastHit hit;
public Camera camera;
if (Physics.Raycast(camera.transform.position, camera.transform.position.forward, out hit ,1000))
    {
        print("I'm looking at " + hit.transform.name);
    }

Thank you so much for this. This works a treat.