Legacy Documentation: Version 4.5.0

Script language:

  • JS
  • C#
  • Boo
Script language

Select your preferred scripting language. All code snippets will be displayed in this language.

var velocity: Vector3;
Vector3 velocity;
velocity as Vector3

Description

Get the world-space speed of the camera (Read Only).

This camera's motion in units per second as it was during the last frame.

	function Update () {
		print ("Camera moving at " + camera.velocity.magnitude + " m/s");
	}
using UnityEngine;
using System.Collections;

public class ExampleClass : MonoBehaviour {
    void Update() {
        print("Camera moving at " + camera.velocity.magnitude + " m/s");
    }
}
import UnityEngine
import System.Collections

public class ExampleClass(MonoBehaviour):

	def Update() as void:
		print((('Camera moving at ' + camera.velocity.magnitude) + ' m/s'))