Moving platform speed? - animation update speed?

hi, everyone! Thank you for your time.

I’m new to Unity and I’m trying to make a 3rd person platform game.
There are a lot of moving platforms in the game, and the players will be hopping between these platforms.

Now I have this problem here:
I am about to calculate the speed of the moving platform. So easily I just get the transform info of the platform over frames and it is like this:

function Start () {
    lastPosition = this.transform.position;
}

function FixedUpdate () {
	var platformVelocity =transform.position - lastPosition;
	var moveSpeed = platformVelocity.magnitude / Time.deltaTime;
	lastPosition = transform.position;
}

for experiment I just made the platform making linear movement by animation. But the result is far more beyond my prediction. Usually it was 3, but sometimes it goes up to 10, even 50!

I tried debug and found out that unity doesn’t move the platform linear as I set in animation clip. Sometimes it suddenly moves the platform in a single frame and the velocity gets incredibly high!

So I wander how often does unity update the position of the animated object or is there any way that I can detect the actual moving speed of the moving platforms in the game?

Definitely check out rigidbody.velocity and rigidbody.angularVelocity. If you’re not working with rigid bodies for your platforms, you may want to consider not using the magnitude / Time.deltaTime equation and just calculate the distance traveled based on the last transform.position. You could also just use var velocity = Vector3.Distance(lastPosition, transform.position); to determine it’s distance traveled per axis.