Hi guys, I need to write some code to enable a camera to focus on an object ( as well as disable other cameras in the level )
I already have the click this item to do this code done
I just need to know how to do this. I have 4 cameras in total , so the game flow is like this
arrow to move to camera 4 ------ GAME FOCUS 1 ----- Arrow to move to camera 2
(AT camera 1)
arrow to move to camera 1 ------ GAME FOCUS 2 ----- Arrow to move to camera 3
(AT camera 2)
The arrows are buttons FYI
var lookatme : GameObject;
var padlight : GameObject;
var thatwasclicked : GameObject;
function Update ()
{
if (Input.GetMouseButtonDown(0))
{
print("turn the cam please .");
var hit : RaycastHit;
var ray : Ray = Camera.main.ScreenPointToRay(Input.mousePosition);
if (Physics.Raycast(ray,hit,100.0))
{
if(hit.transform.transform.gameObject == thatwasclicked )
{
var myCam : Camera = gameObject.find ("My Camera").GetComponent( SmoothLookAt);
myCam.enabled = true ;
var myCam.Target = gameObject = lookatme ;
}
}
}
}
this is the code I have so far ?
Any suggestions