So, I need to switch/ move/ animate camera from point X (not point A,as I don't know where the camera is at that momemnt) to point B (place where you want your camera to move).
This is for cinematics...like when you press a button in game which does something (opens doors maybe) but you can't see where nor what did you activate, so you show the player with the camera where and what happened.
- I tried to animate camera to position, camera just goes crazy.
- Then I tried to make an empty object placed at the position where the camera should be and move camera with code to that objects position.
- I tried enabling Camera 2 and disabeling Camera 1 but it just doesn't work.
Enable/ Disable Code:
public var door: DoorAnim;
public var triggered : boolean = false;
function OnTriggerEnter() { triggered= true; }
function OnTriggerExit() { triggered= false;}
function Update(){
if (triggered && Input.GetKeyDown(KeyCode.JoystickButton1)){
Debug.Log("Door 1 built");
camera1 = GameObject.Find("Camera1");
camera1.enable = false;
camera2 = GameObject.Find("Camera2");
camera2.enable = true;
door= GameObject.Find("door1");
door.animation.Play();
}