How do I make the camera move forward via C# script?
Hello Unity Community! I'm currently working on the splashscreen for my game and I'm having some issues with the camera.
Currently, my scene has my group logo and an empty space. The camera zooms into the logo, then after a timer, transitions into the main menu.
What I would like to do is change it so the camera itself is actually moving forward and then, when it touches the collider/trigger box around the icon, it fades to black and transitions into the main menu.
This is the script I have for my splashscreen, which affects the camera:
using UnityEngine;
using System.Collections;
public class Splash : MonoBehaviour {
public int level = 1;
public float setTime = 3.0f;
public float dimTime = 2.0f;
public Light dimLight;
public float zoomSpeed = 0.2f;
Camera c;
float timer;
// Use this for initialization
void Start () {
c = GetComponent<Camera>();
timer = 0.0f;
}
// Update is called once per frame
void Update () {
timer += Time.deltaTime;
c.fieldOfView -= zoomSpeed;
if (timer > dimTime && timer < setTime) {
dimLight.intensity -= zoomSpeed;
} else if (timer > setTime) {
Application.LoadLevel(level);
}
}
}
I would greatly appreciate any and all advice on this, especially if screenshots are included :D
Your answer
Follow this Question
Related Questions
Camera animation clip stuck on first frame 0 Answers
Fade an object when player enters a trigger 0 Answers
Best way to transition between two skybox textures 0 Answers
Making A Model Transparent/Fade? Unity-chan etc... 3 days no results! 0 Answers
How to fade in and out two logos inside the same scene? [c#] 1 Answer