void FixedUpdate()
{
if (movingPlatform.enabled) {
if (movingPlatform.activePlatform != null) {
if (!movingPlatform.newPlatform) {
//Vector3 lastVelocity = movingPlatform.platformVelocity;
movingPlatform.platformVelocity = (
movingPlatform.activePlatform.localToWorldMatrix.MultiplyPoint3x4(movingPlatform.activeLocalPoint)
- movingPlatform.lastMatrix.MultiplyPoint3x4(movingPlatform.activeLocalPoint)
) / Time.deltaTime;
}
movingPlatform.lastMatrix = movingPlatform.activePlatform.localToWorldMatrix;
movingPlatform.newPlatform = false;
}
else {
movingPlatform.platformVelocity = Vector3.zero;
}
}
if (useFixedUpdate)
UpdateFunction();
}