普通、浮動小数点数の比較には==は使わない、というか使い物にならないはずなんですけど、Unityでは
if (destPosition == transform.position)
{
// Stop Move
}
なぜかこれ、成立しちゃうんですよね
で、調べてみたら
原文
Returns true if two vectors are approximately equal.
To allow for floating point inaccuracies, the two vectors are considered equal if the magnitude of their difference is less than 1e-5.
意訳
二つのVectorが”おおよそ等しかったら”trueを返します
具体的にはVector間の距離が1e-5(10の-5乗:0.00001)より小さかったら”等しい”と判断します
ということらしいです
自前でMathf.Approximately()で比較しなくていいので楽ですね