How Rigidbody.velocity Works?

Hey guys
I’ve been playing around with a little FPS movement and so in and my movement is controlled with physics. Now I saw something on a tutorial about Rigidbody. Velocity and couldn’t quite figure out what he ment. I Googled it and found that velocity is the direction it moves on a certain axis, but when I have this code when I’m standing still its velocity is 3?
var moveSpeed : float;

function Update () {
moveSpeed = rigidbody.velocity.x;

Can someone please explain in depth what velocity and if you have the time magnitude to?
Your noob,

velocity is your speed except its your speed in 3 different directions

velocity has 3 components the x the y and the z

x is horizontal y is up and down and z is “depth” back and forwards.

velocity.y for example is your speed but only in the up direction
a space shuttle would have a lot of that.

velocity.x or velocity.z is forward and back. a car would have that but very little Y speed (having it only during the trek up and down hills)

basically if your velocity is (1,2,3)
it means (by default in unity the default units of measurement are meters and seconds)

you travel 1 meter per second right, 2 meters per second up and 3 meters per second forward.

(-1,-2,-3) would be going left, down, and backward. velocity can be relative to the object or global

that means it can either be global in which case up is always up. or it can be relative to the object.

for example a jet diving down GLOBALLY is moving down. but to the jet its not going down. because the nose is pointed down and the nose is the forward part of the object to the jet locally its going forward, because on a jet forward is whatever way the nose is pointed.

that means the velocity could either b

global (0,-1,0) (going down 1 meter per second)
local (0,0,1) (going forward 1 meter per second)

velocity has a magnitude. thats the length of the line from the origin (0,0,0)
to the velocity vector itself.

this is your speed, but more specifically it’s your speed IN ALL 3 DIMENSIONS COMBINED

a car for example has a speedometer, but that only measures forward motion and reverse motion.

a car drifting very hard could show a speed of 0 because the speedometer does not measure horizontal speed. so you could be going very fast sideways and not show any speed.

velocity on the other hand (a true measurement) would show that speed.

so its your speed in each of the 3 axes.