- Home /
Question by
coleG · Dec 10, 2014 at 02:26 AM ·
camera-scrolling
How do you make the camera scroll faster over time
I'm trying to get my camera to move faster over time. The script that i'm using at the moment is this.
using UnityEngine;
using System.Collections;
public class cameramovement : MonoBehaviour {
public Vector3 Scroll = new Vector3 (0,2);
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
transform.Translate (Vector3.up * Time.deltaTime);
}
}
using UnityEngine;
using System.Collections;
public class cameramovement : MonoBehaviour {
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
transform.Translate (Vector3.up * Time.deltaTime);
}
}
TY
Comment
Answer by Vurawid · Dec 10, 2014 at 04:15 AM
Here is some code that linearly increases the camera speed over time. Attach to the camera or change the current code with it. Change the Speed Start and Increase Per Second values from the camera object.
public class CameraMovement : MonoBehaviour
{
public float speedStart;
public float increasePerSecond;
private float secondsElapsed = 0;
// Update is called once per frame
void Update ()
{
transform.Translate (Vector3.up * Time.deltaTime * (increasePerSecond * secondsElapsed + speedStart));
secondsElapsed += Time.deltaTime;
}
}
Your answer
![](https://koobas.hobune.stream/wayback/20220613173630im_/https://answers.unity.com/themes/thub/images/avi.jpg)