Vector3.Distance function unclear

when i display it out, i thought starting distanceTravelled should be 0 why is it 15.02341 ??? can any1 help me out thx as starting its not moving, so it should be 0, so when i make it move then it increase distance travelled…

var distanceTravelled :float = 0;

var lastPosition: Vector3;

var cube :Transform;

function Start(){

   lastPosition = cube.tranform.position;
}

function Update(){

   distanceTravelled += Vector3.Distance(cube.transform.position,lastPosition);

    lastPosition = cube.transform.position;

}

Is that cube moving ? You could try to get the distance yourself, [AB] = (B - A).magnitude

Try replacing

lastPosition = cube.tranform.position;

with

lastPosition = cube.transform.position;

I’m actually surprised it didn’t stop with an error.