소스 검색

Merge pull request #23632 from DualMatrix/floating_point

Fixed floating point issue in find() of animation.
Rémi Verschelde 6 년 전
부모
커밋
c3023e84c2
1개의 변경된 파일1개의 추가작업 그리고 1개의 파일을 삭제
  1. 1 1
      scene/resources/animation.cpp

+ 1 - 1
scene/resources/animation.cpp

@@ -1469,7 +1469,7 @@ int Animation::_find(const Vector<K> &p_keys, float p_time) const {
 
 		middle = (low + high) / 2;
 
-		if (p_time == keys[middle].time) { //match
+		if (Math::abs(p_time - keys[middle].time) < CMP_EPSILON) { //match
 			return middle;
 		} else if (p_time < keys[middle].time)
 			high = middle - 1; //search low end of array