Camera move to location tagged object

Hello guys,

I am learning the basics of programming (Im a visual artist) and currently I am trying to make a demo with the Oculus Rift. I am trying to create a hands free movement in an environment just as this demo (Oculus Rift DK2 - Vision through 1 (Kira / Demo) - YouTube) Where at 0:30 seconds the person is looking at an object (or tag) and after a while the camera wil move to that location. This is what I am trying to recreate. I started with the Find Closest Enemy example, but I am not sure if I am on the right track.

If anything is unclear, let me know and I will try to clear things up.

Help would be appreciated!

/EDIT/ Here is the code that I have so far:

using UnityEngine;
using System.Collections;

// Find the name of the closest enemy

GameObject FindClosestEnemy() {
	GameObject[] gos;
	gos = GameObject.FindGameObjectsWithTag("Enemy");
	GameObject closest = null;
	float distance = Mathf.Infinity;
	Vector3 position = transform.position;
	foreach (GameObject go in gos) {
		Vector3 diff = go.transform.position - position;
		float curDistance = diff.sqrMagnitude;
		if (curDistance < distance) {
			closest = go;
			distance = curDistance;
		}
	}
	return closest;
}
}

I think the best solution would be to cast a ray from your camera into the scene.
If you put your “lookable” objects onto one layer, you can use this as your mask layer for the raycast.
The reason for this is that the ray just hits objects that you can move to and does not get disturbed by other objects that might be between your camera and a lookable object.

Once you have a hit you can do some visual effects like highlighting and so on.
After a short period of time, lets say 1 second, you can check if the ray is still hitting that particular object. If this is true, move your camera towards that object.

I’ve created a sample scene to demonstrate this. The only thing you have to do is import Unity’s standard assets to get a FPS Controller for the mouse look script that is attached.

https://dl.dropboxusercontent.com/u/59805598/Lookable.zip

Cheers!
Rob